-
Notifications
You must be signed in to change notification settings - Fork 68
Debugger not debugging #1364
Comments
@JoanEliot Can you check and make sure you have only one python extension ( If so, can you check the python extension folder for log files? |
@karthiknadig There's only one python extension in the extensions folder, though I recall removing an empty folder with an old version number yesterday or maybe the day before, when I was trying to fix the problem myself. One point to add is that I am running VSC in "portable mode" per the official instructions on doing so--again, that worked fine in the past--so my extensions are in a subfolder of VSC itself. Yesterday I tried installing it the regular way, with the extensions located in %USERPROFILE%.vscode\extensions, and got exactly the same results. I just checked and that location likewise has only one copy of the python extension. Anywhere, here's the log file from the extensions folder for the run I just made (same behavior in VSC as described above). 5:01:46 PM, 4/16/2019 {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"python","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us"},"type":"request","seq":1} {"seq":1,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsExceptionInfoRequest":true,"supportsConfigurationDoneRequest":true,"supportsDelayedStackTraceLoading":true,"supportsConditionalBreakpoints":true,"supportsSetVariable":true,"supportsExceptionOptions":true,"supportsGotoTargetsRequest":true,"supportsEvaluateForHovers":true,"supportsModulesRequest":true,"supportsValueFormattingOptions":true,"supportsHitConditionalBreakpoints":true,"supportsSetExpression":true,"supportsLogPoints":true,"supportTerminateDebuggee":true,"supportsCompletionsRequest":true,"exceptionBreakpointFilters":[{"filter":"raised","label":"Raised Exceptions","default":false},{"filter":"uncaught","label":"Uncaught Exceptions","default":true}]}} {"command":"launch","arguments":{"name":"Python: Current File (Integrated Terminal)","type":"python","request":"launch","program":"i:\Programming\Python3\_Code\hello.py","console":"integratedTerminal","logToFile":true,"pythonPath":"I:\Programming\Python3\python.exe","cwd":"i:\Programming\Python3\.Code","envFile":"i:\Programming\Python3\.Code\.env","stopOnEntry":false,"showReturnValue":false,"internalConsoleOptions":"neverOpen","debugOptions":["RedirectOutput","FixFilePathCase"],"workspaceFolder":"i:\Programming\Python3\.Code","__sessionId":"ef6cd016-20d2-470d-9436-07d02d67be78"},"type":"request","seq":2} {"command":"runInTerminal","arguments":{"kind":"integrated","title":"Python Debug Console","cwd":"i:\Programming\Python3\.Code","args":["I:\Programming\Python3\python.exe","i:\PortableApps\VSC 1.33.1\data\extensions\ms-python.python-2019.3.6558\pythonFiles\ptvsd_launcher.py","--default","--client","--host","localhost","--port","58469","i:\Programming\Python3\_Code\hello.py"],"env":{"PYTHONIOENCODING":"UTF-8","PYTHONUNBUFFERED":"1"}},"type":"request","seq":2} {"type":"response","seq":3,"command":"runInTerminal","request_seq":2,"success":true,"body":{"shellProcessId":12672}} To Client: To Client: {"type": "event", "seq": 0, "event": "output", "body": {"category": "telemetry", "output": "ptvsd", "data": {"version": "4.2.7"}}}Content-Length: 113 {"type": "response", "seq": 1, "request_seq": 2, "success": true, "command": "launch", "message": "", "body": {}}Content-Length: 865 {"type": "response", "seq": 2, "request_seq": 1, "success": true, "command": "initialize", "message": "", "body": {"supportsCompletionsRequest": true, "supportsConditionalBreakpoints": true, "supportsConfigurationDoneRequest": true, "supportsDebuggerProperties": true, "supportsDelayedStackTraceLoading": true, "supportsEvaluateForHovers": true, "supportsExceptionInfoRequest": true, "supportsExceptionOptions": true, "supportsHitConditionalBreakpoints": true, "supportsLogPoints": true, "supportsModulesRequest": true, "supportsSetExpression": true, "supportsSetVariable": true, "supportsValueFormattingOptions": true, "supportTerminateDebuggee": true, "supportsGotoTargetsRequest": true, "exceptionBreakpointFilters": [{"filter": "raised", "label": "Raised Exceptions", "default": false}, {"filter": "uncaught", "label": "Uncaught Exceptions", "default": true}]}}Content-Length: 63 {"type": "event", "seq": 3, "event": "initialized", "body": {}} {"command":"setBreakpoints","arguments":{"source":{"name":"hello.py","path":"i:\Programming\Python3\.Code\hello.py"},"lines":[1],"breakpoints":[{"line":1}],"sourceModified":false},"type":"request","seq":4} {"command":"setBreakpoints","arguments":{"source":{"name":"hello.py","path":"i:\Programming\Python3\_Code\hello.py"},"lines":[1],"breakpoints":[{"line":1}],"sourceModified":false},"type":"request","seq":5} {"command":"setBreakpoints","arguments":{"source":{"name":"MileageScraper 001.py","path":"i:\Programming\Python3\.Code\MileageScraper 001.py"},"lines":[1],"breakpoints":[{"line":1}],"sourceModified":false},"type":"request","seq":6} To Client: {"type": "response", "seq": 5, "request_seq": 5, "success": true, "command": "setBreakpoints", "message": "", "body": {"breakpoints": [{"id": 1, "verified": true, "line": 1}]}}Content-Length: 176 {"type": "response", "seq": 6, "request_seq": 4, "success": true, "command": "setBreakpoints", "message": "", "body": {"breakpoints": [{"id": 2, "verified": true, "line": 1}]}} {"command":"setExceptionBreakpoints","arguments":{"filters":["uncaught"]},"type":"request","seq":7} {"type": "response", "seq": 7, "request_seq": 7, "success": true, "command": "setExceptionBreakpoints", "message": "", "body": {}} {"command":"configurationDone","type":"request","seq":8} To Client: {"type": "response", "seq": 9, "request_seq": 8, "success": true, "command": "configurationDone", "message": "", "body": {}} {"command":"threads","type":"request","seq":9} {"type": "event", "seq": 10, "event": "thread", "body": {"reason": "started", "threadId": 1}} {"type": "response", "seq": 11, "request_seq": 9, "success": true, "command": "threads", "message": "", "body": {"threads": [{"id": 1, "name": "MainThread"}]}} To Client: To Client: {"command":"threads","type":"request","seq":10} {"type": "response", "seq": 14, "request_seq": 10, "success": true, "command": "threads", "message": "", "body": {"threads": []}} {"type": "event", "seq": 15, "event": "exited", "body": {"exitCode": 0}} {"type": "event", "seq": 16, "event": "terminated", "body": {}} {"command":"disconnect","arguments":{"restart":false},"type":"request","seq":11} {"type": "response", "seq": 17, "request_seq": 11, "success": true, "command": "disconnect", "message": "", "body": {}} |
Note the lowercase |
@int19h, @DonJayamanne, @karthiknadig: I note with appreciation the concern expressed for users in various comments in #1311. I'm unfamiliar with the configuration settings referred to in the workaround for that manifestation (having to do with localhost etc). If that workaround approach is likely or reasonably possibly to be helpful for me, I would very much appreciate guidance in how to apply it, ideally in step-by-step, for-boneheads form. I settled on VSC as my editor/development environment last year--still using it to write bits of Lilypond/Scheme, HTML, and what not--so I am hopeful here. I do lean on the debugging services a lot, so if the workaround isn't relevant for me, please let me know so that I can find at least a temporary alternative tool for my current little Python project. (In that case, any recommendations for the easiest-to-get-up-to-speed-with Python IDE with basic debugging functionality?). Thank you. |
@JoanEliot you can add breakpoint() before/after the line you wanna debug. More on this: https://code.visualstudio.com/docs/python/debugging#_invoking-a-breakpoint-in-code |
Also, I solved the problem on Windows 10 by disabling case sensitivity for the project folder as in https://wpdev.uservoice.com/forums/266908-command-prompt-console-windows-subsystem-for-l/suggestions/34400512-recursive-file-case-sensitivity Note that disabling sensitivity on one folder only affects that folder and not subfolders. |
@Biarys: Thanks for the input, but:
|
I can attach and see threads, but debugger not stopping at breakpoints. Environment: ptvsd Version: 4.2.8 |
@Red-Five If you want to debug files in |
@karthiknadig I removed that info to avoid confusion; Remote docker location Local dev location I forgot to mention remote app is running in docker on Google Kubernetes Engine if that's relevant. |
@Red-Five Can you share your launch json configuration? |
@karthiknadig All details here: https://github.com/Red-Five/google-cloud-code-forseti-security/wiki { |
@Red-Five The debugger expects local and remote root mapping via path mappings. This is a typical attach configuration: {
"name": "Attach",
"type": "python",
"request": "attach",
"port": 5678,
"host": "localhost",
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "."
}
]
}, The above "." for remote assumes that you want to map your workspace directory in VSCode to the working directory in the process where |
I think this issue is fixed now (there were some fixed issues related lowercase/uppercase drive letter which sometimes VSCode sent and the debugger didn't expect), so, I'm closing it. If it still doesn't work for you in the latest release, please reopen. |
Update: The debugger still fails in just the way above detailed on my system (now running VSC 1.36.1 with Python ext 2019.6.24221). However, it turns out the failure is confined to files stored on my I: drive, a VeraCrypt encrypted virtual disk (https://www.veracrypt.fr/en/). The debugger works fine with the same code when the files are stored on other drives, including Cryptomator encrypted ones (https://cryptomator.org). I hope I can be excused for failing earlier to test the possibility that the encryption was involved, since everything had worked fine with my source files on the encrypted I: drive with earlier versions of VSC and the extension. Whatever changes in the extension and/or VSC that have caused the conflict with the VeraCrypt drive, it may be such an arcane problem that it's not worth tracking it down. I can work around it by moving my files, an inconvenience in terms of my workflow and backup system but not a big deal. I'm reporting the detail just in case it helps in some way. |
@JoanEliot, I wonder if perhaps that particular virtual disk uses a case-sensitive filesystem? That should be fairly easy to check by intentionally miscasing files from command line. On our end, we generally assume that all filesystems are case-insensitive on Win32. Which is almost always true in practice, but technically it does support case-sensitivity (and it can even be enabled on NTFS partitions). So it would be interesting to know if this is the problem. |
@int19h, the disk doesn't seem to implement case sensitivity, at the user level anyway. It behaves just like "regular" Windows in this regard, as far as I can tell--the case of each character in a file or folder name can be specified, and is retained and displayed in file listings, but case is ignored for file manipulation operations. For example, you can't create two files in the same folder whose names differ only in case. |
@JoanEliot commented on Mon Apr 15 2019
Environment data
Expected behaviour
Debugging: Stop on breakpoints, display variables, permit stepwise execution
Actual behaviour
Either (a, yesterday) program execution hangs/nothing happens--debug toolbar appears but the only button that works is the stop button; or (b, today) program executes to completion successfully, without stopping at breakpoint. No variables appear in the sidebar in either case, but the status bar does flash orange in scenario b, not in a. Difference between (a) and (b) may be due to installing 1.33.1 in the interval--not sure when I updated from 1.33.0. (No problems evident to me running code without debugging/via 'Run Code.')
When I was last active in VSC and the Python extension, about a year ago everything worked fine. Same computer but of course Windows, Python, VSC and the extension have all had updates.
Steps to reproduce:
Follow tutorial at https://code.visualstudio.com/docs/python/python-tutorial#_configure-and-run-the-debugger (and preceding on same page).
Set breakpoint on line 1 and/or line 2.
Press F5.
Watch screen. Status bar flashes orange very briefly (no changes visible in sidebar), then "Hello World" appears in terminal.
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"logToFile": true
}
]
}
Logs
Terminal output:
PS I:\Programming\Python3.Code> cd 'i:\Programming\Python3.Code'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'I:\Programming\Python3\python.exe' 'i:\PortableApps\VSC 1.33.1\data\extensions\ms-python.python-2019.3.6558\pythonFiles\ptvsd_launcher.py' '--default' '--client' '--host' 'localhost' '--port' '63065' 'i:\Programmi> cd 'i:\Programming\Python3.Code'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'I:\Programming\Python3\python.exe' 'i:\PortableApps\VSC 1.33.1\data\extensions\ms-python.python-2019.3.6558\pythonFiles\ptvsd_launcher.py' '--default' '--client' '--host' 'localhost' '--port' '63100' 'i:\Programming\Python3_Code\hello.py'
Hello World
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Output from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
; turn on source maps to make any tracebacks be useful by runningEnable source map support for extension debugging
):No output under Console. Can't find Enable source map support... setting.
Debugger logs (via launch.json LogToFile
[2019-04-15 23:00:02.209] [exthost] [info] extension host started
[2019-04-15 23:00:02.231] [exthost] [info] ExtensionService#_doActivateExtension vscode.python {"startup":false,"activationEvent":"onLanguage:python"}
[2019-04-15 23:00:02.231] [exthost] [info] ExtensionService#loadCommonJSModule i:\PortableApps\VSC 1.33.1\resources\app\extensions\python\out\pythonMain
[2019-04-15 23:00:02.233] [exthost] [info] ExtensionService#_doActivateExtension ms-python.python {"startup":false,"activationEvent":"onLanguage:python"}
[2019-04-15 23:00:02.233] [exthost] [info] ExtensionService#loadCommonJSModule I:\PortableApps\VSC 1.33.1\data\extensions\ms-python.python-2019.3.6558\out\client\extension
[2019-04-15 23:00:02.358] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch {"startup":true,"activationEvent":""}
[2019-04-15 23:00:02.358] [exthost] [info] ExtensionService#loadCommonJSModule i:\PortableApps\VSC 1.33.1\resources\app\extensions\debug-auto-launch\dist\extension
[2019-04-15 23:00:02.364] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet {"startup":true,"activationEvent":""}
[2019-04-15 23:00:02.364] [exthost] [info] ExtensionService#loadCommonJSModule i:\PortableApps\VSC 1.33.1\resources\app\extensions\emmet\dist\extension
[2019-04-15 23:00:02.368] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"activationEvent":""}
[2019-04-15 23:00:02.368] [exthost] [info] ExtensionService#loadCommonJSModule i:\PortableApps\VSC 1.33.1\resources\app\extensions\git\dist\main
[2019-04-15 23:00:02.415] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict {"startup":true,"activationEvent":""}
[2019-04-15 23:00:02.415] [exthost] [info] ExtensionService#loadCommonJSModule i:\PortableApps\VSC 1.33.1\resources\app\extensions\merge-conflict\dist\extension
[2019-04-15 23:00:02.418] [exthost] [info] ExtensionService#_doActivateExtension alefragnani.Bookmarks {"startup":true,"activationEvent":""}
[2019-04-15 23:00:02.418] [exthost] [info] ExtensionService#loadCommonJSModule I:\PortableApps\VSC 1.33.1\data\extensions\alefragnani.bookmarks-10.4.3\dist\extension
[2019-04-15 23:00:02.420] [exthost] [info] ExtensionService#_doActivateExtension alefragnani.numbered-bookmarks {"startup":true,"activationEvent":""}
[2019-04-15 23:00:02.420] [exthost] [info] ExtensionService#loadCommonJSModule I:\PortableApps\VSC 1.33.1\data\extensions\alefragnani.numbered-bookmarks-6.2.0\dist\extension
[2019-04-15 23:00:02.422] [exthost] [info] eager extensions activated
[2019-04-15 23:00:11.616] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-server-ready {"startup":false,"activationEvent":"onDebugResolve"}
[2019-04-15 23:00:11.616] [exthost] [info] ExtensionService#loadCommonJSModule i:\PortableApps\VSC 1.33.1\resources\app\extensions\debug-server-ready\dist\extension
3-Git.log has
The text was updated successfully, but these errors were encountered: