Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

AttributeError: module 'builtins' has no attribute 'interpreter' when you do anything in the debug console #1072

Closed
brettcannon opened this issue Dec 14, 2018 · 2 comments
Assignees
Milestone

Comments

@brettcannon
Copy link
Member

@lovettchris commented on Thu Dec 13 2018

Repro

  1. Create test.py containing:
print("Hello World")
  1. then run "code hello.py" from a console that is configured with an Anaconda version of Python 3.6.
  2. put a breakpoint on that line and press F5
  3. click "Debug Console" and type in "import os"

Actual

Traceback (most recent call last):
  File "c:\Users\clovett\.vscode\extensions\ms-python.python-2018.12.0\pythonFiles\lib\python\ptvsd\_vendored\pydevd\pydevconsole.py", line 449, in get_interpreter
    interpreterInterface = getattr(__builtin__, 'interpreter')
AttributeError: module 'builtins' has no attribute 'interpreter'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "c:\Users\clovett\.vscode\extensions\ms-python.python-2018.12.0\pythonFiles\lib\python\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 1381, in do_it
    msg = _pydev_completer.generate_completions_as_xml(frame, self.act_tok)
  File "c:\Users\clovett\.vscode\extensions\ms-python.python-2018.12.0\pythonFiles\lib\python\ptvsd\_vendored\pydevd\_pydev_bundle\_pydev_completer.py", line 167, in generate_completions_as_xml
    completions = pydevconsole.get_completions(act_tok, act_tok, updated_globals, frame.f_locals)
  File "c:\Users\clovett\.vscod...
@fabioz
Copy link
Contributor

fabioz commented Dec 15, 2018

@lovettchris can you post the full stack trace? It's strange because in the code that AttributeError: module 'builtins' has no attribute 'interpreter' is protected (https://github.com/Microsoft/ptvsd/blob/master/src/ptvsd/_vendored/pydevd/pydevconsole.py#L449), so, trying to make sense of it (maybe the full stack trace can help).

Also, do you know which version of IPython are you using? -- sometimes the console breaks because of changes/issues in IPython.

@awav
Copy link

awav commented Dec 28, 2018

@fabioz, Here is a full stack trace:

Traceback (most recent call last):
  File "/Users/artemav/.vscode/extensions/ms-python.python-2018.12.1/pythonFiles/lib/python/ptvsd/_vendored/pydevd/pydevconsole.py", line 449, in get_interpreter
    interpreterInterface = getattr(__builtin__, 'interpreter')
AttributeError: module 'builtins' has no attribute 'interpreter'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Users/artemav/.vscode/extensions/ms-python.python-2018.12.1/pythonFiles/lib/python/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 1381, in do_it
    msg = _pydev_completer.generate_completions_as_xml(frame, self.act_tok)
  File "/Users/artemav/.vscode/extensions/ms-python.python-2018.12.1/pythonFiles/lib/python/ptvsd/_vendored/pydevd/_pydev_bundle/_pydev_completer.py", line 167, in generate_completions_as_xml
    completions = pydevconsole.get_completions(act_tok, act_tok, updated_globals, frame.f_locals)
  File "/Users/artemav/.vscode/extens...
$ ipython --version
6.2.1

karthiknadig pushed a commit that referenced this issue Jan 2, 2019
…builtins has no interpreter) (#1081)

* Change completions command to Debug Adapter Protocol. Fixes #1000

* Fixed 'NoneType' object is not callable. Fixes #987
@karthiknadig karthiknadig added this to the Dec 2018.3 milestone Jan 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants