Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error processing grammar ModuleNotFoundError: No module named 'grammarinator.parser.ANTLRv4Lexer' #49

Closed
CityOfLight77 opened this issue Jun 10, 2022 · 3 comments

Comments

@CityOfLight77
Copy link

I'm installing latest grammarinator on master and got this error when I want to generate json (I separate some rules from original json grammar file to the lexer and parser in order to successful generating output)

cityoflight:json cityoflight$ grammarinator-process JSONLexer.g4 JSONParser.g4 --no-actions -o output
-sh: grammarinator-process: command not found
cityoflight:json cityoflight$ source ~/.bash_profile
cityoflight:json cityoflight$ grammarinator-process JSONLexer.g4 JSONParser.g4 --no-actions -o output
Traceback (most recent call last):
  File "/Users/cityoflight/Library/Python/3.9/bin/grammarinator-process", line 5, in <module>
    from grammarinator.process import execute
  File "/Users/cityoflight/Library/Python/3.9/lib/python/site-packages/grammarinator/__init__.py", line 11, in <module>
    from .process import FuzzerFactory
  File "/Users/cityoflight/Library/Python/3.9/lib/python/site-packages/grammarinator/process.py", line 28, in <module>
    from .parser import ANTLRv4Lexer, ANTLRv4Parser
  File "/Users/cityoflight/Library/Python/3.9/lib/python/site-packages/grammarinator/parser/__init__.py", line 8, in <module>
    from .ANTLRv4Lexer import ANTLRv4Lexer
ModuleNotFoundError: No module named 'grammarinator.parser.ANTLRv4Lexer'

But when I uninstall latest one and using old one by typing pip3 install grammarinator I'm successfully generating json output

@CityOfLight77
Copy link
Author

@renatahodovan

@renatahodovan
Copy link
Owner

@CityOfLight77 Inspecting your log it seems that at your first trial, Grammarinator wasn't installed at all:

-sh: grammarinator-process: command not found

At the second trial, Grammarinator was installed, but its source was probably newer than the installed version, since it complained about the missing 'grammarinator.parser.ANTLRv4Lexer' module which should have been generated build time.

Lastly,

pip3 install grammarinator

worked since it installed the latest release from PyPI and not from your local repository.

What you should do to use your own checkout with the latest master is to execute the following install command from the root directory of Grammarinator:

pip3 install .

Please tell me if it worked!

@renatahodovan
Copy link
Owner

@CityOfLight77 Closing for now, but please don't hesitate to reopen it if the problem still persist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants