poppinpopeyes
poppinpopeyes

Reputation: 1

WinError2 genericpath.py error while debugging?

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
    }

]

Upvotes: 0

Views: 283

Answers (2)

Franz Mayr
Franz Mayr

Reputation: 1

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.

Upvotes: 0

MingJie-MSFT
MingJie-MSFT

Reputation: 9209

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.

Upvotes: -1

Related Questions