Closed bashterm closed 6 years ago
Hello,
I believe those codes are color codes used in syntax hilighting and are a function of the underlying kernel (e.g., ipython). Using Jupyter Enterprise Gateway, which derives from JKG, I just introduced a syntax error and got back the following...
'content': {'ename': 'SyntaxError',
'engine_info': {'engine_id': -1,
'engine_uuid': '007b1c2b-2a4b-41a9-afe3-22bc3851fbc1',
'method': 'execute'},
'evalue': 'unexpected EOF while parsing '
'(<ipython-input-1-50c06c4f46d7>, line 1)',
'execution_count': 0,
'payload': [],
'status': 'error',
'traceback': ['\x1b[0;36m File '
'\x1b[0;32m"<ipython-input-1-50c06c4f46d7>"\x1b[0;36m, '
'line \x1b[0;32m1\x1b[0m\n'
"\x1b[0;31m print('Hello World'\x1b[0m\n"
'\x1b[0m ^\x1b[0m\n'
'\x1b[0;31mSyntaxError\x1b[0m\x1b[0;31m:\x1b[0m '
'unexpected EOF while parsing\n'],
'user_expressions': {}},
which produces this output in a notebook...
However, if I first issue #colors NoColor
, then terminal colors are disabled and I get back this...
'content': {'ename': 'SyntaxError',
'engine_info': {'engine_id': -1,
'engine_uuid': '0b254f3d-552c-46c1-90d5-389adee92e44',
'method': 'execute'},
'evalue': 'unexpected EOF while parsing '
'(<ipython-input-1-50c06c4f46d7>, line 1)',
'execution_count': 0,
'payload': [],
'status': 'error',
'traceback': [' File "<ipython-input-1-50c06c4f46d7>", line 1\n'
" print('Hello World'\n"
' ^\n'
'SyntaxError: unexpected EOF while parsing\n'],
'user_expressions': {}},
I'd expect similar results using a straight (non-gateway) notebook configuration as well.
I hope this helps.
Thank you so much. I would never have figured that out on my own. I really appreciate it.
I've been working on a standalone angular app that utilizes the @jupyterlab/services package in order to interact with the kernel gateway.
Connection works and execution works, but when an error occurs the traceback array comes through very messed up. I'm not sure what the problem is. The result looks like this:
It seems to be an encoding issue, but I can't figure out how to fix it.
Thanks for any help