panda-planner-dev / pandaPIparser

The parser of the pandaPI planning system
BSD 3-Clause "New" or "Revised" License
13 stars 10 forks source link

Feature request: write error output to STDERR #12

Closed rpgoldman closed 1 year ago

rpgoldman commented 1 year ago

What happened

When I did this:

 pandaPIparser repair-domain.hddl repair-problem.hddl > repair.htn

I found in repair.htn:

pandaPIparser is configured as follows
  Colors in output: true
  Mode: parsing mode
  Parameter splitting: true
  Conditional effects: exponential encoding
  Disjunctive preconditions as HTN: false
  Replace goal with action: false
  Output: pandaPI format
Parse error in file repair-domain.hddl in line 2
unexpected NAME, expecting KEY_DEFINE

What I expected

I think the last line of the above should have been written to stderr instead of to stdout. Then I would see the parse error displayed in the terminal, even though I was redirecting stdout to a file.

rpgoldman commented 1 year ago

Actually, this problem is more of an issue than I had expected. The parser dumps that "pandaPIparser is configured" header into its standard output, meaning that even when the parser runs successfully, if I redirect its output from stdout to a file, I get a file that the grounder can't handle.

Interestingly, if I supply an output file on the command line, the header goes to the terminal, and not to the output.

So this isn't a huge issue, but it's a bit confusing that the three argument form of invocation works differently from using two arguments and redirecting the output.

galvusdamor commented 1 year ago

Indeed! This should not happen. I have modified the code of the parser s.t. it outputs its configuration information and errors during parsing to stderr instead of stdout. This should now allow the user to directly pipe the output into the parser output file.

The output of the plan verifier remains on stdout - as this output is the actual content-wise output of the validator.

rpgoldman commented 1 year ago

The output of the plan verifier remains on stdout - as this output is the actual content-wise output of the validator.

That sounds right to me, too. Thanks for patching.