Java 实现继续正常工作,但 Python 实现(在升级到 4.10.1 之前也一直正常工作)现在在 ATNDeserializer.py 的调整中在第 89 行抛出 TypeError
这是一个已知的错误吗?
Traceback (most recent call last):
File "/Users/vickery/Projects/dgw_processor/dgw_parser.py", line 15, in <module>
from ReqBlockLexer import ReqBlockLexer
File "/Users/vickery/Projects/dgw_processor/ReqBlockLexer.py", line 421, in <module>
class ReqBlockLexer(Lexer):
File "/Users/vickery/Projects/dgw_processor/ReqBlockLexer.py", line 423, in ReqBlockLexer
atn = ATNDeserializer().deserialize(serializedATN())
File "/opt/homebrew/lib/python3.10/site-packages/antlr4/atn/ATNDeserializer.py", line 61, in deserialize
self.reset(data)
File "/opt/homebrew/lib/python3.10/site-packages/antlr4/atn/ATNDeserializer.py", line 91, in reset
temp = [ adjust(c) for c in data ]
File "/opt/homebrew/lib/python3.10/site-packages/antlr4/atn/ATNDeserializer.py", line 91, in <listcomp>
temp = [ adjust(c) for c in data ]
File "/opt/homebrew/lib/python3.10/site-packages/antlr4/atn/ATNDeserializer.py", line 89, in adjust
v = ord(c)
TypeError: ord() expected string of length 1, but int found
我未能更新antlr4-python3-runtime。
您重新生成了词法分析器和解析器吗? 当我使用 v4.9.2 生成代码时,我遇到了同样的错误。但是当我将antlr4-python3-runtime更新到v4.10时,错误被修复了。
我遇到了同样的问题,你是否更新了antlr4-python3-runtime,只需使用命令
pip install antlr4-python3-runtime
因为我已经尝试过但不适合我,或者我还缺少其他事情吗?