stencila / py

Stencila for Python
Apache License 2.0
17 stars 1 forks source link

Syntax error doesn't get displayed #19

Closed apawlik closed 6 years ago

apawlik commented 6 years ago
messages
:
[{type: "error", message: "'SyntaxError' object has no attribute 'message'",…}]
0
:
{type: "error", message: "'SyntaxError' object has no attribute 'message'",…}
message
:
"'SyntaxError' object has no attribute 'message'"
trace
:
"Traceback (most recent call last):↵  File "/home/aleksandra/anaconda3/lib/python3.6/site-packages/stencila/python_context.py", line 70, in compile↵    tree = ast.parse(cell['code'], mode='exec')↵  File "/home/aleksandra/anaconda3/lib/python3.6/ast.py", line 35, in parse↵    return compile(source, filename, mode, PyCF_ONLY_AST)↵  File "<unknown>", line 1↵    [1,2,3↵         ^↵SyntaxError: unexpected EOF while parsing↵↵During handling of the above exception, another exception occurred:↵↵Traceback (most recent call last):↵  File "/home/aleksandra/anaconda3/lib/python3.6/site-packages/stencila/python_context.py", line 74, in compile↵    'message': exc.message,↵AttributeError: 'SyntaxError' object has no attribute 'message'↵"
type
:
"error"
nokome commented 6 years ago

I have made the handling of syntax errors more robust so that this particular error won't happen. However, note that the actual syntax error does not get displayed in the UI for any language - something that needs to be addressed in stencila/stencila.