saulpw/aipl

useful Python errors supressed

dovinmu opened this issue · 1 comments

Writing Python code in a !python op that errors (eg from not importing something that you're using) leads to this confusing error:

(global) task = result of 
Traceback (most recent call last):
  File "/Users/rowan/Documents/aipl/venv/bin/aipl", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/rowan/Documents/aipl/aipl/main.py", line 79, in main
    aipl.run(open(fn).read(), *inputs)
  File "/Users/rowan/Documents/aipl/aipl/interpreter.py", line 105, in run
    cmds = self.parse(script)
           ^^^^^^^^^^^^^^^^^^
  File "/Users/rowan/Documents/aipl/aipl/interpreter.py", line 95, in parse
    result = self.eval_op(command, Table(), contexts=[self.globals])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rowan/Documents/aipl/aipl/interpreter.py", line 169, in eval_op
    assert not ret  # ignore return value (no rankout)
    ^^^^^^^^^^^^^^
AssertionError

This is the op that caused this:

!!python
@defop('json-parse-custom', 0, 1.5)
def op_json_parse(aipl, v:str, **kwargs) -> Table:
    pass

I believe @saulpw has some error-handling on his computer that might address this!