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

ValueError: malformed node or string: <_ast.Call object at 0x000000001A5BA588> #7444

Closed
agnesbao opened this issue Jul 13, 2018 · 7 comments
Closed

Comments

@agnesbao
Copy link

Description

What steps will reproduce the problem?

  1. After I run this code snippet, it pops the error window:
    try:
    kwls = record['PubmedArticle'][0]['MedlineCitation']['KeywordList'][0]
    for w in kwls:
    abs_str.append(w)
    except:
    abs_str.append('')

  2. Then I cannot run any code unless I restart Spyder

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

Please provide any additional information below

File "C:\Users\Xiaojun\Anaconda3\lib\site-packages\qtconsole\base_frontend_mixin.py", line 163, in _dispatch
handler(msg)
File "C:\Users\Xiaojun\Anaconda3\lib\site-packages\spyder\widgets\ipythonconsole\namespacebrowser.py", line 220, in _handle_execute_reply
self.handle_exec_method(msg)
File "C:\Users\Xiaojun\Anaconda3\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 354, in handle_exec_method
view = ast.literal_eval(literal)
File "C:\Users\Xiaojun\Anaconda3\lib\ast.py", line 85, in literal_eval
return _convert(node_or_string)
File "C:\Users\Xiaojun\Anaconda3\lib\ast.py", line 66, in _convert
in zip(node.keys, node.values))
File "C:\Users\Xiaojun\Anaconda3\lib\ast.py", line 65, in
return dict((_convert(k), _convert(v)) for k, v
File "C:\Users\Xiaojun\Anaconda3\lib\ast.py", line 66, in _convert
in zip(node.keys, node.values))
File "C:\Users\Xiaojun\Anaconda3\lib\ast.py", line 65, in
return dict((_convert(k), _convert(v)) for k, v
File "C:\Users\Xiaojun\Anaconda3\lib\ast.py", line 84, in _convert
raise ValueError('malformed node or string: ' + repr(node))
ValueError: malformed node or string: <_ast.Call object at 0x000000001A5BA588>

@dalthviz
Copy link
Member

Hi @agnesbao this seems like a duplicate of #5636

Please update Spyder with:

conda update spyder

@ccordoba12
Copy link
Member

Thanks @dalthviz! Closing because this was solved a long time ago.

@Sherochen
Copy link

@ccordoba12 Hello, May I know how did you solve this problem? I am facing the same error now but cannot manage to solve it. Thanks.

@ccordoba12
Copy link
Member

You need to update Spyder. It was a problem in our side.

@mkkuemmel
Copy link

@ccordoba12 Hi, unfortunately, I still have this problem, even though I updated Spyder to 3.3.2.
Is there anything else I can do?

@ccordoba12
Copy link
Member

@MiriamKl, please open a new issue and give us a simple and reproducible code that generates this problem.

@Zhongyi-89
Copy link

Zhongyi-89 commented Jun 25, 2020

@mkkuemmel @ccordoba12 @Sherochen You may want to try to use "eval()" instead of "literal_eval()".
Or check your Object type by "type(literal)", as <The string or node provided may only consist of the following Python literal structures: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and None.>

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

No branches or pull requests

6 participants