antlr4 icon indicating copy to clipboard operation
antlr4 copied to clipboard

Could not deserialize ATN with version (expected 4).

Open moxi828 opened this issue 2 years ago • 12 comments

OS:ubuntu 22.04 python:3.10.6 java:1.8 ATN:4.8

python runtime error: raise Exception("Could not deserialize ATN with version " + str(version) + " (expected " + str(SERIALIZED_VERSION) + ").") Exception: Could not deserialize ATN with version (expected 4).

How to solve this problem? thank you

moxi828 avatar Dec 03 '22 03:12 moxi828

Hi,Have you tried regenerating your parser?Envoyé de mon iPhoneLe 3 déc. 2022 à 04:15, moxi828 @.***> a écrit : OS:ubuntu 22.04 python:3.10.6 java:1.8 ATN:4.8 python runtime error: raise Exception("Could not deserialize ATN with version " + str(version) + " (expected " + str(SERIALIZED_VERSION) + ").") Exception: Could not deserialize ATN with version (expected 4). How to solve this problem? thank you

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

ericvergnaud avatar Dec 03 '22 07:12 ericvergnaud

Hi,Have you tried regenerating your parser?Envoyé de mon iPhoneLe 3 déc. 2022 à 04:15, moxi828 @.> a écrit : OS:ubuntu 22.04 python:3.10.6 java:1.8 ATN:4.8 python runtime error: raise Exception("Could not deserialize ATN with version " + str(version) + " (expected " + str(SERIALIZED_VERSION) + ").") Exception: Could not deserialize ATN with version (expected 4). How to solve this problem? thank you —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.>

Sorry, I'm a novice, and I don't know much about this. I'm preparing to learn related knowledge. The above error occurred when I was preparing to run a tool named PiRL. So what should I do to regenerate the parser? Thank you very much for your patience.

moxi828 avatar Dec 03 '22 08:12 moxi828

I know nothing about PiRL, so can't really help. Please read the online docs to find out how to regenerate your parser.

ericvergnaud avatar Dec 03 '22 09:12 ericvergnaud

I know nothing about PiRL, so can't really help. Please read the online docs to find out how to regenerate your parser.

thank you very much

moxi828 avatar Dec 03 '22 11:12 moxi828

I know nothing about PiRL, so can't really help. Please read the online docs to find out how to regenerate your parser.

Which file explains how to regenerate my parser?please? I have the same problem when using antlr4, which can not be solved so far. Thank you for your answer.

zhangwenmeng111 avatar Dec 03 '22 12:12 zhangwenmeng111

I know nothing about PiRL, so can't really help. Please read the online docs to find out how to regenerate your parser.

How should I regenerate my parser? Which online docs shoud l read? Thank you very much!

zhangwenmeng111 avatar Dec 03 '22 12:12 zhangwenmeng111

Hi,

I had the same issue with exactly the same error message when I tried to run the 04-Calc example from py3antlr4book.

The GIT repo of py3antlr4book shipped an old version of ANTLR (antlr-4.7.2-complete.jar), which is incompatible with the latest antlr4-python3-runtime that I installed via PyPI (4.11.1).

In my case, I upgraded the version of ANTLR for generating the parser and created a PR to fix the issue in the book: https://github.com/jszheng/py3antlr4book/pull/15. Using the antlr4 executable that ships with antlr4-python3-runtime instead of the JAR from py3antlr4book also solves the problem.

In your case, you probably either have to regenerate the parser of the PiRL tool using the latest ANTLR or downgrade to an older version of the Python 3 package antlr4-python3-runtime if you don't want to make changes in PiRL.

jcmuel avatar Dec 23 '22 13:12 jcmuel

Try to reinstall antlr4 runtime with appropriate version: pip uninstall antlr4-python3-runtime pip install antlr4-python3-runtime==<ANTLR version> To check your ANTLR version run antlr4 command.

eugenos-programos avatar Mar 21 '23 09:03 eugenos-programos

I downgraded my antlr4-python3-runtime to 4.9.3 and the error fixed.

iliyami avatar Apr 10 '23 00:04 iliyami

Try to reinstall antlr4 runtime with appropriate version: pip uninstall antlr4-python3-runtime pip install antlr4-python3-runtime==<ANTLR version> To check your ANTLR version run antlr4 command.

I installed with pip install antlr4-python3-runtime==$(antlr4 | grep Version | awk '{print $5;}')

himito avatar Sep 25 '23 14:09 himito

python

xnerhu avatar Jan 11 '24 22:01 xnerhu

Thank you @iliyami

It works

AI-General avatar Mar 22 '24 16:03 AI-General