AI-Planning / planutils

General library for setting up linux-based environments for developing, running, and evaluating planners.
MIT License
103 stars 30 forks source link

Incorrect parsing of arguments with spaces #130

Closed TheAeryan closed 1 year ago

TheAeryan commented 1 year ago

I have been trying to add my package, lifted-pddl to planutils. I forked the repo and created a new folder with my package. Then, I tested it and everything seemed to work fine until I tried some command-line options that make use of blank spaces. For example, this works:

(planutils) root@f35be806d5ad:~$ lifted-pddl get_applicable_actions -d domain.pddl -p problem.pddl

but this doesn't work (note the argument containing a blank space that appears after -a):

(planutils) root@f35be806d5ad:~$ lifted-pddl is_action_applicable -d domain.pddl -p problem.pddl -a "(put-down obj10)"

I think the root of this issue is how argparse is used to parse the arguments to planutils, since when I use my package (lifted-pddl) outside planutils, it does work.

I will now add a pull request with my new package lifted-pddl. As soon as this issue is solved, everything should work fine.

haz commented 1 year ago

Hrmz...where is the argparse coming into play? Best I can see, it will first hit this line (shows what is included in a file for planutils commands): https://github.com/AI-Planning/planutils/blob/main/planutils/__init__.py#L37

And then the run script that you included in the PR. So it's just a pair of bash scripts. Maybe they need to be quoted? I.e., "$@"

TheAeryan commented 1 year ago

I tried quoting "$@" in lifted-pddl's run script and it worked! Thanks for the help 😊 I will do the new pull request for planutils.