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.

Debugger raising exception when typing command to Debug Console

See original GitHub issue

Environment data

  • VS Code version: 1.28.0
  • Extension version : 2018.9.0
  • OS and version: Microsoft Windows [Version 10.0.17763.1]
  • Conda version : Anaconda 4.5.11
  • Python version: 3.6.6, 3.5.5
  • Type of virtual environment used : conda

Actual behavior

Since last update, when trying to debug a code by typing a command on the Debug Console after it hit a breakpoint, the debugger raises an exception as soon as the first character is typed.

Expected behavior

No exception

Steps to reproduce:

def main():
    a_string = "hello world"
    print(a_string)

if __name__ == "__main__":
    main()
  1. Start debugging
  2. Wait until it hits a breakpoint (i.e: on print(a_string))
  3. Try to type a command on Debug Console (i.e: a_string)
  4. Watch Debug Console and Terminal

Logs

Console Output

Microsoft Windows [Version 10.0.17763.1]
(c) 2018 Microsoft Corporation. All rights reserved.

D:\Source\Repos\vscode_bug>


                           activate base

(base) D:\Source\Repos\vscode_bug>cd d:\Source\Repos\vscode_bug && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && C:\ProgramData\Anaconda3\python.exe c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd_launcher.py 54696 d:\Source\Repos\vscode_bug\vscode_debug_test.py "
Traceback (most recent call last):
  File "c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\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\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 1419, in do_it
    msg = _pydev_completer.generate_completions_as_xml(frame, self.act_tok)
  File "c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\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\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\ptvsd\_vendored\pydevd\pydevconsole.py", line 460, in get_completions
    interpreterInterface = get_interpreter()
  File "c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\ptvsd\_vendored\pydevd\pydevconsole.py", line 451, in get_interpreter
    interpreterInterface = InterpreterInterface(None, None, threading.currentThread())
  File "c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\ptvsd\_vendored\pydevd\_pydev_bundle\pydev_ipython_console.py", line 25, in __init__
    self.interpreter = get_pydev_frontend(host, client_port)
  File "c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\ptvsd\_vendored\pydevd\_pydev_bundle\pydev_ipython_console_011.py", line 491, in get_pydev_frontend
    _PyDevFrontEndContainer._instance = _PyDevFrontEnd()
  File "c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\ptvsd\_vendored\pydevd\_pydev_bundle\pydev_ipython_console_011.py", line 340, in __init__
    self.ipython = PyDevTerminalInteractiveShell.instance()
  File "C:\ProgramData\Anaconda3\lib\site-packages\traitlets\config\configurable.py", line 412, in instance
    inst = cls(*args, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\IPython\terminal\interactiveshell.py", line 425, in __init__
    super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 488, in __init__
    self.init_completer()
  File "c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\ptvsd\_vendored\pydevd\_pydev_bundle\pydev_ipython_console_011.py", line 262, in init_completer
    self.Completer = self._new_completer_600()
  File "c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\ptvsd\_vendored\pydevd\_pydev_bundle\pydev_ipython_console_011.py", line 224, in _new_completer_600
    parent=self
  File "c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\ptvsd\_vendored\pydevd\_pydev_bundle\pydev_ipython_console_011.py", line 95, in __init__
    IPCompleter.__init__(self, *args, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\completer.py", line 1110, in __init__
    self.dict_key_matches,
AttributeError: can't set attribute

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\xml\sax\expatreader.py", line 217, in feed
    self._parser.Parse(data, isFinal)
xml.parsers.expat.ExpatError: syntax error: line 1, column 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\ptvsd\wrapper.py", line 1292, in done
    fut.result()
  File "c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\ptvsd\futures.py", line 40, in result
    reraise(self._exc_info)
  File "c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\ptvsd\reraise3.py", line 8, in reraise
    raise exc_info[1].with_traceback(exc_info[2])
  File "c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\ptvsd\futures.py", line 155, in callback
    x = it.send(fut.result())
  File "c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\ptvsd\wrapper.py", line 2272, in on_completions
    xml = self.parse_xml_response(resp_args)
  File "c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\ptvsd\wrapper.py", line 1345, in parse_xml_response
    return untangle.parse(io.BytesIO(args.encode('utf8'))).xml
  File "c:\Users\gloch\.vscode\extensions\ms-python.python-2018.9.0\pythonFiles\experimental\ptvsd\ptvsd\untangle.py", line 198, in parse
    parser.parse(filename)
  File "C:\ProgramData\Anaconda3\lib\xml\sax\expatreader.py", line 111, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "C:\ProgramData\Anaconda3\lib\xml\sax\xmlreader.py", line 125, in parse
    self.feed(buffer)
  File "C:\ProgramData\Anaconda3\lib\xml\sax\expatreader.py", line 221, in feed
    self._err_handler.fatalError(exc)
  File "C:\ProgramData\Anaconda3\lib\xml\sax\handler.py", line 38, in fatalError
    raise exception
xml.sax._exceptions.SAXParseException: <unknown>:1:0: syntax error

launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File (Integrated Terminal)",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        }
    ]
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
gnlochcommented, Nov 1, 2018

@fabioz this bug appeared using ipython 6.2.1. Coincidentally, I was about to report that updating to ipython 6.5.0 solves this issue. Given that this issue was not related to vscode-python, I will close it.

2reactions
karthiknadigcommented, Oct 15, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

Manage exceptions with the debugger in Visual Studio
In the Exception Settings window, open the shortcut menu by right-clicking a column label, and then select Show Columns > Additional Actions. ( ......
Read more >
Exception handing and debugging in Python - Index of /
Exceptions are raised by different kinds of errors arising when executing Python code. In your own code, you may also catch errors, or...
Read more >
How can I see the details of an exception in Python's debugger?
File "test.py", line 3, in some_function raise Exception('An exception message with ... In VSCode, type the import in the bottom debug bar.
Read more >
10. Debugging and Error Handling - JavaScript Cookbook ...
When the code that could result in an error is contained in a try statement, the associated catch statement handles the exception it...
Read more >
Chapter 7: Exception Handling and Debugging
Warnings can be raised at any time in your program and can be used to display some type of warning message, but they...
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