Repository navigation
Python debugger not running when the start button is clicked on #1291
Copy link
Copy link
Closed
Labels
area-debuggingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
Description
Environment data
- VS Code version: 1.21.1
- Extension version (available under the Extensions sidebar): 2018.3.1
- OS and version: Windows 10, version 1709
- Python version (& distribution if applicable, e.g. Anaconda): Anaconda 5.1.0 Python 3.6.4
- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
- Relevant/affected Python packages and their versions: XXX
Actual behavior
I start the Debug, but it keeps loading and does not actually start the debug process:

The blue bar keeps moving left to right but the debug process doesn't start.
I have checked whether it's an issue with the Debugger by Debugging a .c file, but that works just fine, so it must be a problem with Python.
In the integrated terminal, within cd command, this comes up:
" ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'C:\Users\surya\Anaconda3\python.exe'".... "'51334' '34806ad9-833a-4524-8cd6-18ca4aa74f14' 'RedirectOutput,RedirectOutput'"
Expected behavior
The Debug starts and then runs
Steps to reproduce:
- Unsure; it was working before, but isn't anymore...
Logs
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
##########Linting Output - pylint##########
No config file found, using default configuration
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)
[C:\Users\surya\.vscode\extensions\ms-vscode.cpptools-0.16.1]: Command `workbench.action.gotoSymbol` appears multiple times in the `commands` section.
extensionService.ts:786 [C:\Users\surya\.vscode\extensions\ms-vscode.cpptools-0.16.1]: Command `workbench.action.showAllSymbols` appears multiple times in the `commands` section.
TMSyntax.ts:43 Overwriting grammar scope name to file mapping for scope source.python.
Old grammar file: c:\Program Files\Microsoft VS Code\resources\app\extensions\python\syntaxes\MagicPython.tmLanguage.json.
New grammar file: C:\Users\surya\.vscode\extensions\magicstack.magicpython-1.0.12\grammars\MagicPython.tmLanguage
e.register @ TMSyntax.ts:43
TMSyntax.ts:43 Overwriting grammar scope name to file mapping for scope text.bibtex.
Old grammar file: C:\Users\surya\.vscode\extensions\James-Yu.latex-workshop-5.0.3\syntax\Bibtex.plist.
New grammar file: C:\Users\surya\.vscode\extensions\torn4dom4n.latex-support-1.5.1\grammars\BibTeX.json
e.register @ TMSyntax.ts:43
TMSyntax.ts:43 Overwriting grammar scope name to file mapping for scope text.tex.latex.
Old grammar file: C:\Users\surya\.vscode\extensions\James-Yu.latex-workshop-5.0.3\syntax\LaTeX.plist.
New grammar file: C:\Users\surya\.vscode\extensions\torn4dom4n.latex-support-1.5.1\grammars\LaTeX.json
e.register @ TMSyntax.ts:43
TMSyntax.ts:43 Overwriting grammar scope name to file mapping for scope text.tex.
Old grammar file: C:\Users\surya\.vscode\extensions\James-Yu.latex-workshop-5.0.3\syntax\TeX.plist.
New grammar file: C:\Users\surya\.vscode\extensions\torn4dom4n.latex-support-1.5.1\grammars\TeX.json
e.register @ TMSyntax.ts:43
console.ts:136 [Extension Host] Congratulations, your extension "terminal" is now active!
console.ts:136 [Extension Host] activating extension
console.ts:136 [Extension Host] Starting express server on port: 51692
console.ts:136 [Extension Host] using C:/Users/surya/.vscode/extensions/vsciot-vscode.vscode-arduino-0.2.11/vendor/node-usb-native/lib/native/usb-native_win32_1.7.3_x64.node
console.ts:136 [Extension Host] Python Extension: Failed to get conda environment list from conda Error: spawn conda ENOENT
at exports._errnoException (util.js:1050:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
t.log @ console.ts:136
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-debuggingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
Activity
brettcannon commentedon May 3, 2018
Suryava Bhattacharya (@SuryavaBhattacharya) can you do a few things for us?
pythonto"type": "pythonExperimental")launch.jsonandsettings.json?DonJayamanne commentedon May 4, 2018
Also, please disable all extensions except for the
Pythonextension when trying this out.SuryavaBhattacharya commentedon May 14, 2018
Brett Cannon (@brettcannon)
The debugger still doesn't initiate, with normal launch settings.
Using experimental modes gives mixed results:
It either gives a timeout error "Timeout waiting for debugger connection" or it runs with the following error:
It alternates between these two errors. So, if I debug it once, it'll give the timeout error. Then clicking debug again runs the debugger and I can debug, but the error above is given. You could say it works but you have try it multiple times and it still gives the error above....
My settings code for python are as follows:
Details
My launch.json is:
Details
{ // 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": "Watson", "type": "pythonExperimental", "request": "launch", "program": "${workspaceFolder}/console.py", "args": [ "dev", "runserver", "--noreload=True" ], "jinja": true }, { "name": "Python Experimental: Terminal (integrated)", "type": "pythonExperimental", "request": "launch", "program": "${file}", "console": "integratedTerminal" }, { "name": "Python Experimental: Terminal (external)", "type": "pythonExperimental", "request": "launch", "program": "${file}", "console": "externalTerminal" }, { "name": "Scrapy", "type": "pythonExperimental", "request": "launch", "module": "scrapy", "args": [ "crawl", "specs", "-o", "bikes.json" ] }, { "name": "PySpark", "type": "pythonExperimental", "request": "launch", "osx": { "pythonPath": "${env:SPARK_HOME}/bin/spark-submit" }, "windows": { "pythonPath": "${env:SPARK_HOME}/bin/spark-submit.cmd" }, "linux": { "pythonPath": "${env:SPARK_HOME}/bin/spark-submit" }, "program": "${file}" }, { "name": "Pyramid", "type": "pythonExperimental", "request": "launch", "args": [ "${workspaceFolder}/development.ini" ], "pyramid": true, "jinja": true }, { "name": "Flask", "type": "pythonExperimental", "request": "launch", "module": "flask", "env": { "FLASK_APP": "${workspaceFolder}/app.py" }, "args": [ "run", "--no-debugger", "--no-reload" ], "jinja": true }, { "name": "Django", "type": "pythonExperimental", "request": "launch", "program": "${workspaceFolder}/manage.py", "args": [ "runserver", "--noreload", "--nothreading" ], "django": true }, { "name": "Attach (Remote Debug)", "type": "pythonExperimental", "request": "attach", "port": 3000, "host": "localhost" }, { "name": "Python: Current File", "type": "python", "request": "launch", "program": "${file}" }, { "name": "Python: Attach", "type": "python", "request": "attach", "localRoot": "${workspaceFolder}", "remoteRoot": "${workspaceFolder}", "port": 3000, "secret": "my_secret", "host": "localhost" }, { "name": "Python: Terminal (integrated)", "type": "python", "request": "launch", "program": "${file}", "console": "integratedTerminal" }, { "name": "Python: Terminal (external)", "type": "python", "request": "launch", "program": "${file}", "console": "externalTerminal" }, { "name": "Python: Django", "type": "python", "request": "launch", "program": "${workspaceFolder}/manage.py", "args": [ "runserver", "--noreload", "--nothreading" ], "debugOptions": [ "RedirectOutput", "Django" ] }, { "name": "Python: Flask (0.11.x or later)", "type": "python", "request": "launch", "module": "flask", "env": { "FLASK_APP": "${workspaceFolder}/app.py" }, "args": [ "run", "--no-debugger", "--no-reload" ] }, { "name": "Python: Module", "type": "python", "request": "launch", "module": "module.name" }, { "name": "Python: Pyramid", "type": "python", "request": "launch", "args": [ "${workspaceFolder}/development.ini" ], "debugOptions": [ "RedirectOutput", "Pyramid" ] }, { "name": "Python: Watson", "type": "python", "request": "launch", "program": "${workspaceFolder}/console.py", "args": [ "dev", "runserver", "--noreload=True" ] }, { "name": "Python: All debug Options", "type": "python", "request": "launch", "pythonPath": "${config:python.pythonPath}", "program": "${file}", "module": "module.name", "env": { "VAR1": "1", "VAR2": "2" }, "envFile": "${workspaceFolder}/.env", "args": [ "arg1", "arg2" ], "debugOptions": [ "RedirectOutput" ] } ] }Thanks
SuryavaBhattacharya commentedon May 14, 2018
Don Jayamanne (@DonJayamanne) Disabling all the other extensions, except the Python extension, had no additional effect.
chen2013 commentedon May 15, 2018
met the same problem when debugging time-consuming functions with django
DonJayamanne commentedon May 16, 2018
Please could you provide some sample code that we could use to replicate this issue.
mike-pt commentedon Jun 8, 2018
I'm running into the same after a few successful tries, in some case it also was working again after reboot... but now I can't even make it work after reboot...
I wonder if this is somewhat related to https://stackoverflow.com/questions/13597812/pydev-cant-debug-anymore?
mike-pt commentedon Jun 8, 2018
Hum.. I deleted
*.sock *Cache* and *cookies*dirs under~/Library/Application Support/Codeclosed/reopen vsCode and now pydev starts the process with the same config...So perhaps we are not cleaning something? I'm unsure what to be honest but perhaps this offers some hint Don Jayamanne (@DonJayamanne) ?
EDIT: I also deleted the
Local Storagedir as a last resort, almost forgot to mention, I just hit the issue again, and doing that does fix the issue.DonJayamanne commentedon Jun 9, 2018
Miguel C (@mike-pt)
Please confirm you are able to replicate this by debugging a simple python script containing either a print or a loop.
mike-pt commentedon Jun 9, 2018
No I can't and I doubt that's possible.
I believe this is only triggered when debugging complex scripts (with imports to other files and args etc)
With a simple print this seems to work fine.
I feels like if we have to stop / restart the debugger for some reason we hit this issue.
I investigated further and wipped just the keys that were related to debug and python in LocalStorage restarted and this makes it work again...
I also tested by turning of the automatic breakpoints (on exceptions) let it run until the end.... Then again... And again and I couldn't repro...
Using stopped doesn't always cause it though which is intriguing... Might also have to do with where I'm stopping ...
In any case I suppose if clearing LocalStorage fixes it, maybe it means vscode is not cleaning thing properly after a debug session is unexpectedly terminated... Which como think of it might be a vscode issue and not the extension?
But yeah it seems only complex scripts trigger it...
SuryavaBhattacharya commentedon Jun 12, 2018
For me, this problem occurs regardless of the complexity of the script. It still as I described in my precious post. The debugger doesn't run or is volatile when running. It does unexpected things and doesn't stop at breakpoints if it does run
DonJayamanne commentedon Jun 12, 2018
Suryava Bhattacharya (@SuryavaBhattacharya) Please could you change your terminal from
powershelltocommand prompt.See here https://code.visualstudio.com/docs/editor/integrated-terminal#_common-questions
Once changed, please restart VS Code and test once again.
SuryavaBhattacharya commentedon Jun 13, 2018
Don Jayamanne (@DonJayamanne) I tried this to no avail....
DonJayamanne commentedon Jun 13, 2018
Suryava Bhattacharya (@SuryavaBhattacharya)
Help->Toggle Developer Toolsand look for errors in the `console windowSuryavaBhattacharya commentedon Jun 14, 2018
Don Jayamanne (@DonJayamanne) It seems that after I restarted my computer, your solution worked!
Thank you so much!!
In terms of error messages, my previous comments contains the error messages I have been getting and the terminal window messages, in case you want to keep these for future reference.