1

I am trying to debug my Python code in Visual Studio Code. It skips all my breakpoints and finds an error in genericpath.py.

Exception has occurred: FileNotFoundError [WinError 2] The system cannot find the file specified: 'C:\Users\mlongtin\AppData\Local\Programs\Python\Python39\python39.zip' File "C:\Users\mlongtin\AppData\Local\Programs\Python\Python39\Lib\genericpath.py", line 19, in exists os.stat(path) File "C:\Users\mlongtin\AppData\Local\Programs\Python\Python39\Lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\mlongtin\AppData\Local\Programs\Python\Python39\Lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\Users\mlongtin\AppData\Local\Programs\Python\Python39\python39.zip'

I have tried restarting Visual Studio and the debugger, but nothing is working. This is my launch.json file:

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

]

asked Sep 19, 2023 at 20:03

2 Answers 2

0

Hi I had the same issue and found my solution here: https://github.com/microsoft/vscode-python/issues/10391

With justMyCode: false and Raised Exceptions ticked , this is expected behavior. Debugger is stopping at points in library code where ever exceptions are raised. Note that runpy is in pyhton standard library and it raises FileNotFoundError while trying to find the right module or file.

answered Nov 8, 2023 at 13:40
Sign up to request clarification or add additional context in comments.

2 Comments

This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review
This was the answer for me. To be clear, I had to uncheck "Raised Exceptions" and "Uncaught Exceptions" in the VSCode "Breakpoints" configuration. I think I checked these boxes without knowing what they did.
-1

Why did you have python39.zip.

I think you did not decompress when installing Python.

Download python from python.org and reinstall python may solve this problem.

answered Sep 20, 2023 at 1:57

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.