Closed ssardina closed 6 years ago
Hola Sebastian,
you can only get that error if the parser wasn't generated. Did you install ANLTR4 and its Python 3 bindings as per the instructions I set to you via email?
Cheers,
Miquel.
I think I did all, but let me check all that again. Clearly there is nothing obvious that you spotted so must be my side... Let me check. Thanks for the quick reply though!
Actually, I checked and it does seem I have it all setup well: (I try to install python packages via pip always, not manually, which is what I did):
[ssardina@Thinkpad-X1 fs-private.git]$ echo $CLASSPATH
.:/home/ssardina/opt/antlr/antlr-4.7.1-complete.jar:.:/opt/Agent_Software/lib/jack.jar:
[ssardina@Thinkpad-X1 fs-private.git]$ pip2 list | grep antl
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
antlr4-python2-runtime (4.7.1)
[ssardina@Thinkpad-X1 fs-private.git]$ pip3 list | grep antl
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
antlr4-python3-runtime (4.7.1)
And after running the build I have:
[ssardina@Thinkpad-X1 fs-private.git]$ l python/parser/f
f_pddl_plus/ fs_task.py fstrips_components.py fstrips.py
[ssardina@Thinkpad-X1 fs-private.git]$ l python/parser/f
f_pddl_plus/ fs_task.py fstrips_components.py fstrips.py
[ssardina@Thinkpad-X1 fs-private.git]$ l python/parser/f_pddl_plus/
build_parser.py FunctionalStripsLexer.tokens __pycache__/
fstrips/ FunctionalStrips.tokens Readme.md
FunctionalStrips.g4 __init__.py test_fstrips_parser.py
FunctionalStrips.interp pddl3/
FunctionalStripsLexer.interp Pddl3.g4
[ssardina@Thinkpad-X1 fs-private.git]$ l python/parser/f_pddl_plus/fstrips/
total 624K
drwxrwxr-x 3 ssardina ssardina 4.0K Feb 11 14:44 .
drwxrwxr-x 5 ssardina ssardina 4.0K Feb 11 14:44 ..
-rw-rw-r-- 1 ssardina ssardina 32K Feb 10 14:56 fs_task_loader.py
-rw-rw-r-- 1 ssardina ssardina 1.4K Feb 10 14:56 graph.py
-rw-rw-r-- 1 ssardina ssardina 0 Feb 11 14:44 __init__.py
-rw-rw-r-- 1 ssardina ssardina 45K Feb 11 14:44 lexer.py
-rw-rw-r-- 1 ssardina ssardina 54K Feb 11 14:44 listener.py
-rw-rw-r-- 1 ssardina ssardina 362K Feb 11 14:44 parser.py
drwxrwxr-x 2 ssardina ssardina 4.0K Feb 11 14:44 __pycache__
-rw-rw-r-- 1 ssardina ssardina 9.2K Feb 10 14:56 tasks.py
-rw-rw-r-- 1 ssardina ssardina 32K Feb 11 14:44 visitor.py
This was generated by:
[ssardina@Thinkpad-X1 f_pddl_plus]$ pwd
/home/ssardina/git/soft/planning/planning-with-simulators/fs-private.git/python/parser/f_pddl_plus
[ssardina@Thinkpad-X1 f_pddl_plus]$ ./build_parser.py --grammar FunctionalStrips.g4 --deploy fstrips
Generated files prefix: FunctionalStrips
fstrips/listener.py
fstrips/lexer.py
[('from FunctionalStripsListener', 'from listener'), ('from .FunctionalStripsListener', 'from .listener'), ('from FunctionalStripsVisitor', 'from visitor'), ('from .FunctionalStripsVisitor', 'from .visitor')]
Replaced old module names
fstrips/parser.py
fstrips/visitor.py
[ssardina@Thinkpad-X1 f_pddl_plus]$
is there a missing file FunctionalStripsParser.py
that is not being produced in python/parser/f_pddl_plus
?
But, hold on now. Instructions say:
_"In order to build the parsers, get into the antlr4parsers folder and issue the command:"
and there is no "antlr4_parser", I am doing this in another dir... Should I be using another branch, not v2? ahhh maybe that is it...
Hola @ssardina ,
if you're using the v2
branch you don't need to regenerate the parser, you just need antlr4
installed. Since this version of FS
depends on Python 3, you need to install the Python3 bindings for antlr4
.
The passage
"In order to build the parsers, get into the antlr4_parsers folder and issue the command:"
is deprecated - we changed the layout of the parsers a while ago.
All of the above seems to me unrelated to the original issue. Checking the visitor.py
file we have on the sources, I can't find the import command that caused the problem in your system.
Could you please discard any local changes you have under the python/parsers
folder and try again?
Ohh, yes! I deleted the folder completely and checked out the original one from repo and now it runs well!
So, summing up, wrt the instructions in https://github.com/aig-upf/fs-private/blob/v2/python/parser/f_pddl_plus/Readme.md the part
In order to build the parsers, get into the antlr4_parsers folder and issue the command:
$ ./build_parser.py --grammar FunctionalStrips.g4 --deploy fstrips
which will compile the grammar and generate the corresponding Python classes inside the module fstrips
is not applicable anymore?
Thanks!
I need to revise those docs @ssardina, will do sometime this week so I don't forget :)
Enjoy!
Hi @miquelramirez
I installed soplex, set the Hybrid flag to True, run the python parser, all good. But when I ran the example in the readme:
As far as I can tell the command
has produced all files correctly...
any suggestion?