spyder: Error when getting the namespace view from the kernel
Description
What steps will reproduce the problem?
What is the expected output? What do you see instead?
Please provide any additional information below
File "/anaconda/lib/python3.6/site-packages/qtconsole/base_frontend_mixin.py", line 163, in _dispatch
handler(msg)
File "/anaconda/lib/python3.6/site-packages/spyder/widgets/ipythonconsole/namespacebrowser.py", line 214, in _handle_execute_reply
self.handle_exec_method(msg)
File "/anaconda/lib/python3.6/site-packages/spyder/widgets/ipythonconsole/shell.py", line 311, in handle_exec_method
view = ast.literal_eval(data['text/plain'])
File "/anaconda/lib/python3.6/ast.py", line 85, in literal_eval
return _convert(node_or_string)
File "/anaconda/lib/python3.6/ast.py", line 66, in _convert
in zip(node.keys, node.values))
File "/anaconda/lib/python3.6/ast.py", line 65, in <genexpr>
return dict((_convert(k), _convert(v)) for k, v
File "/anaconda/lib/python3.6/ast.py", line 66, in _convert
in zip(node.keys, node.values))
File "/anaconda/lib/python3.6/ast.py", line 65, in <genexpr>
return dict((_convert(k), _convert(v)) for k, v
File "/anaconda/lib/python3.6/ast.py", line 84, in _convert
raise ValueError('malformed node or string: ' + repr(node))
ValueError: malformed node or string: <_ast.Call object at 0x12f124400>
Version and main components
- Spyder Version: 3.2.0
- Python Version: 3.6.1
- Qt Versions: 5.6.2, PyQt5 5.6 on Darwin
Dependencies
pyflakes >=0.6.0 : 1.5.0 (OK)
pycodestyle >=2.3: 2.3.1 (OK)
pygments >=2.0 : 2.2.0 (OK)
pandas >=0.13.1 : 0.20.1 (OK)
numpy >=1.7 : 1.12.1 (OK)
sphinx >=0.6.6 : 1.5.6 (OK)
rope >=0.9.4 : 0.9.4-1 (OK)
jedi >=0.9.0 : 0.10.2 (OK)
psutil >=0.3 : 5.2.2 (OK)
nbconvert >=4.0 : 5.1.1 (OK)
sympy >=0.7.3 : 1.0 (OK)
cython >=0.21 : 0.25.2 (OK)
qtconsole >=4.2.0: 4.3.0 (OK)
IPython >=4.0 : 5.3.0 (OK)
pylint >=0.25 : 1.6.4 (OK)
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 24 (15 by maintainers)
@dalthviz, giving that this is a very critical error (because it makes the IPython console unusable), I think we should catch all errors when trying to use
ast.literal_evalinhandle_exec_method(specifically inget_namespace_viewandget_var_properties) and raise a new error that includes the values ofviewandproperties.I think something like this should work:
This way we will be able to better understand what the kernel is sending to Spyder.
However, the problem with this is we would also need the code a user is running in the console to make sense of the namespace representation we get in the error.
Let’s wait to see if more errors like this one are reported in the future before implementing this solution.
@mitchell5, I really don’t understand where this error is coming from. If you want to help us to solve it, please follow these steps:
print([data['text/plain']])before line311in/anaconda/lib/python3.6/site-packages/spyder/widgets/ipythonconsole/shell.py.View > Panes > Internal consoleand copy the text printed there after you run1+1in a console.With that info we will be able to understand why the console is not returning the result Spyder expects.
Thank you, it seems like it solved the problem 😃
@dalthviz, please take a look at this one.