Having problems with debugging in .vscode

好久不见. 提交于 2020-01-24 04:37:08

问题


I've had a big problem with debugging in VSCODE lately. I have tried to fix it my self by searching the site and reinstalling some of my extensions.

Instead of showing my results in the debug console it writes the following output to my terminal:

cd /Users/AVFL/Documents/Programming ; env "PYTHONIOENCODING=UTF-8"
PYTHONUNBUFFERED=1" /usr/local/bin/python3
/Users/AVFL/.vscode/extensions/ms-python.python-2018.3.1/pythonFiles/PythonTools/visualstudio_py_launcher.py
/Users/AVFL/Documents/Programming 54323 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput
/Users/AVFL/Documents/Programming/Python/Projects/Entrepeneuring/employeeDatabase.py

and the results from my script show up below that. The results also show up in the debug console but I would like them to only show up there.

I am debugging with the Python: Current file. I have tried changing the console to none in the external and integrated terminal function, but I need those to be default.

What can I do to make it debug in the debug console when I use Python: Current File?


I've seen one post with this question but they changed the console to none and debug in the Python: Integrated Terminal instead of Current File

The problem occurred when I made a virtualenv in my folder.


回答1:


Just go to your launch.json script and find thre attach part. Change the setting from integrated terminal to none. Should work :)




回答2:


I've found the answer myself. Instead of changing the other configurations to print the info in the debug console I create a new Configuration with the name "Python: Current File" which I added as the fist configuration. I made the console "none" in this configuration and I deleted the other one. This solved my problem with out removing other vulnerable settings.




回答3:


Setting "console": "None" in the launch.json is not valid in the latest versions of VS Code. Note, however, that you will still get the desired behavior, but VS Code will consider it an invalid setting. To make VS Code happy, set "console" to "internalConsole" to get the output to go to the Debug Console instead of to a Terminal, like this:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "internalConsole"
        }
    ]
}


来源:https://stackoverflow.com/questions/49639072/having-problems-with-debugging-in-vscode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!