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

We need to pass-thru the ERROR messages in a better way to the Python package #1

Open
vsenderov opened this issue Nov 6, 2023 · 0 comments

Comments

@vsenderov
Copy link

For example, from Python:

$ python3 experiment.py data/jeremy-crbd__12.1.a-1.json data/prior.json
Traceback (most recent call last):
  File "/home/viktor/treeppl-python/treeppl/base.py", line 72, in __init__
    result = from_json(stdout)
  File "/home/viktor/treeppl-python/treeppl/serialization.py", line 41, in from_json
    return json.load(fp, object_hook=object_hook)
  File "/usr/lib/python3.10/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/lib/python3.10/json/__init__.py", line 359, in loads
    return cls(**kw).decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/c/Users/senderov/Sync/Workspaces/Q-T-Birds/experiments/sprint15/experiment.py", line 54, in <module>
    res = qtbirds( tree=tree
  File "/home/viktor/treeppl-python/treeppl/base.py", line 66, in __call__
    return InferenceResult(proc.stdout)
  File "/home/viktor/treeppl-python/treeppl/base.py", line 74, in __init__
    raise InferenceError("Could not parse the output from TreePPL.")
treeppl.exceptions.InferenceError: Could not parse the output from TreePPL.

It is not obvious what the error is. But from the command-line:

$ ./out input.json
ERROR <qtbirds.tppl 217:35-217:45>:
Field 'rigth' not found
  let rightTime = getAgeDiff(tree, tree.rigth);
viktor@BDWF26:~/qtbirds.tppl$

you see that we just misspelled right as rigth.

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

1 participant