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

Error when trying to get a very large namespace view from the kernel #4873

Closed
mpgl opened this issue Aug 1, 2017 · 7 comments
Closed

Error when trying to get a very large namespace view from the kernel #4873

mpgl opened this issue Aug 1, 2017 · 7 comments

Comments

@mpgl
Copy link

mpgl commented Aug 1, 2017

I keep getting the same error after running the following code:

from brian import *
brian_sample_run()

However the output seems to be fine on IPython console.

Error

  File "/home/biomike/anaconda2/lib/python2.7/site-packages/qtconsole/base_frontend_mixin.py", line 163, in _dispatch
Traceback (most recent call last):
  File "/home/biomike/anaconda2/lib/python2.7/site-packages/qtconsole/base_frontend_mixin.py", line 163, in _dispatch
    handler(msg)
  File "/home/biomike/anaconda2/lib/python2.7/site-packages/spyder/widgets/ipythonconsole/namespacebrowser.py", line 214, in _handle_execute_reply
    self.handle_exec_method(msg)
  File "/home/biomike/anaconda2/lib/python2.7/site-packages/spyder/widgets/ipythonconsole/shell.py", line 317, in handle_exec_method
    properties = ast.literal_eval(data['text/plain'])
  File "/home/biomike/anaconda2/lib/python2.7/ast.py", line 49, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/home/biomike/anaconda2/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 9001
    ...}
    ^
SyntaxError: invalid syntax
    handler(msg)
  File "/home/biomike/anaconda2/lib/python2.7/site-packages/spyder/widgets/ipythonconsole/namespacebrowser.py", line 214, in _handle_execute_reply
    self.handle_exec_method(msg)
  File "/home/biomike/anaconda2/lib/python2.7/site-packages/spyder/widgets/ipythonconsole/shell.py", line 311, in handle_exec_method
    view = ast.literal_eval(data['text/plain'])
  File "/home/biomike/anaconda2/lib/python2.7/ast.py", line 49, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/home/biomike/anaconda2/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 4001
    ...}
    ^
SyntaxError: invalid syntax

Version and main components

  • Spyder Version: 3.2.0
  • Python Version: 2.7.13
  • Qt Versions: 5.6.2, PyQt5 5.6 on Linux

Dependencies

pyflakes >=0.5.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.3 (OK)
numpy >=1.7       :  1.13.1 (OK)
sphinx >=0.6.6    :  1.6.2 (OK)
rope >=0.9.4      :  0.9.4 (OK)
jedi >=0.9.0      :  0.10.2 (OK)
psutil >=0.3      :  5.2.2 (OK)
nbconvert >=4.0   :  5.2.1 (OK)
sympy >=0.7.3     :  1.1.1 (OK)
cython >=0.21     :  0.26 (OK)
qtconsole >=4.2.0 :  4.3.0 (OK)
IPython >=4.0;<6.0:  5.3.0 (OK)
pylint >=0.25     :  1.6.4 (OK)
@mpgl mpgl changed the title I keep getting the same error everytime I am trying to run brian1.4 module I keep getting the same error everytime I am trying to import brian1.4 module Aug 1, 2017
@mpgl
Copy link
Author

mpgl commented Aug 1, 2017

Update:
i get the same error everytime i am trying to import everything from a module
for example just running:
from numpy import *

will result to the same error

@ccordoba12 ccordoba12 added this to the v3.2.1 milestone Aug 1, 2017
@ccordoba12 ccordoba12 changed the title I keep getting the same error everytime I am trying to import brian1.4 module Error when trying to get a very large namespace view from the kernel Aug 1, 2017
@ccordoba12
Copy link
Member

I know where this error is coming from. We'll fix it in Spyder 3.2.1, to be released this weekend.

In the meantime, please avoid star imports (i.e. from foo import *) because they can't be handled by Spyder.

@ccordoba12 ccordoba12 self-assigned this Aug 1, 2017
@goanpeca
Copy link
Member

goanpeca commented Aug 1, 2017

What is the error @ccordoba12 ?

@ccordoba12
Copy link
Member

ccordoba12 commented Aug 1, 2017

It's not our fault (I think). IPython is not sending the namespace representation that we build in the kernel correctly, but as a truncated dictionary (because it contains too much elements).

That's why we get ... at the end of representation, which makes ast to fail.

@goanpeca
Copy link
Member

goanpeca commented Aug 1, 2017

Hmm, ok, how do we even fix that :-| ?

@ccordoba12
Copy link
Member

I was thinking to call repr in the kernel side, to avoid this truncation. Then we would need to call ast twice in our side.

@ccordoba12
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants