Spyder: "ValueError: malformed node or string" when evaluating code that contains Path elements

Created on 1 Nov 2017  路  7Comments  路  Source: spyder-ide/spyder

Description

What steps will reproduce the problem?



    1. 2.
  1. 3.

What is the expected output? What do you see instead?

Please provide any additional information below

File "/usr/local/lib/python2.7/dist-packages/qtconsole/base_frontend_mixin.py", line 163, in _dispatch
handler(msg)
File "/usr/local/lib/python2.7/dist-packages/spyder/widgets/ipythonconsole/namespacebrowser.py", line 220, in _handle_execute_reply
self.handle_exec_method(msg)
File "/usr/local/lib/python2.7/dist-packages/spyder/widgets/ipythonconsole/shell.py", line 351, in handle_exec_method
view = ast.literal_eval(literal)
File "/usr/lib/python2.7/ast.py", line 80, in literal_eval
return _convert(node_or_string)
File "/usr/lib/python2.7/ast.py", line 63, in _convert
in zip(node.keys, node.values))
File "/usr/lib/python2.7/ast.py", line 62, in
return dict((_convert(k), _convert(v)) for k, v
File "/usr/lib/python2.7/ast.py", line 63, in _convert
in zip(node.keys, node.values))
File "/usr/lib/python2.7/ast.py", line 62, in
return dict((_convert(k), _convert(v)) for k, v
File "/usr/lib/python2.7/ast.py", line 79, in _convert
raise ValueError('malformed string')
ValueError: malformed string

Version and main components

  • Spyder Version: 3.2.3
  • Python Version: 2.7.12
  • Qt Versions: 4.8.7, PyQt4 (API v2) 4.11.4 on Linux

Dependencies

pyflakes >=0.5.0  :  1.6.0 (OK)
pycodestyle >=2.3 :  2.3.1 (OK)
pygments >=2.0    :  2.2.0 (OK)
pandas >=0.13.1   :  0.16.2 (OK)
numpy >=1.7       :  1.12.1 (OK)
sphinx >=0.6.6    :  1.6.3 (OK)
rope >=0.9.4      :  0.10.7 (OK)
jedi >=0.9.0      :  0.10.2 (OK)
psutil >=0.3      :  5.3.1 (OK)
nbconvert >=4.0   :  5.3.1 (OK)
sympy >=0.7.3     :  0.7.6 (OK)
cython >=0.21     :  0.22.1 (OK)
qtconsole >=4.2.0 :  4.3.1 (OK)
IPython >=4.0;<6.0:  5.4.1 (OK)
pylint >=0.25     :  1.7.2 (OK)

IPython Console Bug

All 7 comments

What code did you evaluate in the IPython console before getting this error?

We have seen this error before, but we need a clear and reproducible way to reproduce it to fix it. So please help us with that.

Okay, after some more digging, it seems to be a problem with using path. If I run the following code either in the iPython console directly or by running a script:

from path import Path
x = Path('blah-blah-blah')

then I get the following dialog from spyder:

Spyder has encountered a problem.
Sorry for the inconvenience.

You can automatically submit this error to our Github issues tracker.

Note: You need a Github account for that.

which contains the error information above. Any time afterwards, if I enter something into the iPython console I get the same dialog. If I restart the iPython kernel, this behavior stops, but if I run the script (or code) again the dialog returns.

Ok, great!! Thanks a lot for finding an easy way to reproduce this problem.

Happy help. Hope it can be sorted out!

Yep, having a way to reproduce it helps a lot!

@dalthviz, please take a look at this one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ok97465 picture ok97465  路  3Comments

Khalilsqu picture Khalilsqu  路  3Comments

goanpeca picture goanpeca  路  3Comments

hedeqing picture hedeqing  路  3Comments

dalthviz picture dalthviz  路  3Comments