Closed VaibhaviRaut closed 4 years ago
Maybe a typo? Try replacing antlr-python3-runtime
with antlr4-python3-runtime
.
I was able to install antlr4 using this command 'antlr4-python3-runtime' but I'm not able to resolve this:
from antlr.SwumParser import SwumParser from antlr.SwumParserVisitor import SwumParserVisitor from antlr.SwumLexer import SwumLexer
I tried to run 'antlr-python3-runtime' for the above error but didn't work :P so I tried to check out the website mentioned in the readme which indicated these steps:
Quick Start See Getting Started with ANTLR v4OS X $ cd /usr/local/lib $ sudo curl -O https://www.antlr.org/download/antlr-4.8-complete.jar $ export CLASSPATH=".:/usr/local/lib/antlr-4.8-complete.jar:$CLASSPATH" $ alias antlr4='java -jar /usr/local/lib/antlr-4.8-complete.jar' $ alias grun='java org.antlr.v4.gui.TestRig'
I tried them, nothing really happened.
The imports from antlr
are referring to the directory in the swum_phrases folder, so no need to install anything :)
Your IDE will complain about not being able to resolve the imports -- this is because when you run the swum_phrases
script, the script first generates python files in the antlr directory before running SwumPhrases.py
. Try the command . ./swum_phrases tests/testcases/simple_success.xml output.xml
and see if it works.
Also if you haven't already, I would put the last three commands from the getting started page at the end of your ~/.bashrc
file - this will save you from having to re-type them every time you open your terminal.
I tried running the cmd and below is the output, I'm not sure if it worked. Oh and my bad I forgot to mention but I'm using Pycharm IDE.
OUTPUT:
_(venv) (base) Vaibhavis-MacBook-Pro:swum_phrases vaibhaviraut$ . ./swum_phrases tests/testcases/simple_success.xml output.xml
creating antlr files...
bash: antlr4: command not found
running phrases layer...
Traceback (most recent call last):
File "SwumPhrases.py", line 11, in
Also, should the ~/.bashrc file to be modified, be the external one through the system's terminal or through the Pycharm terminal? I tried doing both and tried to re-run the cmd you gave but still getting the same output.
I helped her fix it.
Thanks @BrianPopeck for helping Vaibhavi out.
I followed the instructions in the swum_phrases -> readme and got the antlr4 installation correctly but am still not able to import the antlr library from lines 11 through 13. I tried referring to the website mentioned as well but I might have missed something?
Can you please guide me with the installations or are there any changes to be made?