question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when getting the namespace view from the kernel

See original GitHub issue

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)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:24 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
ccordoba12commented, Aug 4, 2017

@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_eval in handle_exec_method (specifically in get_namespace_view and get_var_properties) and raise a new error that includes the values of view and properties.

I think something like this should work:

if 'get_namespace_view' in method:
    if data is not None and 'text/plain' in data:
        try:
            view = ast.literal_eval(data['text/plain'])
        except Exception as error:
            error = to_text_string(error)
            view = to_text_string(data['text/plain'])
            text = "An error occurred while getting a "
                   "representation of your namespace. "
                   "The error was {0} and the obtained "
                   "value was {1}".format(error, view)
            raise ValueError(text)
    else:
        view = None
    self.sig_namespace_view.emit(view)

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.

1reaction
ccordoba12commented, Jul 31, 2017

@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:

  1. Put a line with print([data['text/plain']]) before line 311 in /anaconda/lib/python3.6/site-packages/spyder/widgets/ipythonconsole/shell.py.
  2. Restart Spyder.
  3. Go to the menu View > Panes > Internal console and copy the text printed there after you run 1+1 in a console.
  4. Post the result here.

With that info we will be able to understand why the console is not returning the result Spyder expects.

Read more comments on GitHub >

github_iconTop Results From Across the Web

1168776 – "Kernel doesn't support user namespace" when ...
Description of problem: Enabling user namespaces gives the error: Kernel doesn't support user namespace: Link has been severed.
Read more >
Kernel' does not exist in the namespace 'Sitecore'
The issue was a result of having the Sitecore.Kernel namespace added in the namespaces portion of the web.config file in the Views directory....
Read more >
Error the type or namespace name [Class] could not be found ...
There is no problem in Visual Studio 2017 but I am getting error on Visual Studio for Mac as following "Error the type...
Read more >
The type or namespace could not be found. - Experts Exchange
In Vs2010 project I have an mvc repository which gives the following errors: 1) The type or namespace name 'OnePerRequestModule' could not ...
Read more >
Resource management: Linux kernel Namespaces and cgroups
Added sock_net() and sock_net_set() methods (get/set network namespace of a socket) ... VXLAN, from one namespace to another, we will encounter an error:....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found