Search code examples
visual-studio-codevscode-debuggervscode-python

Can't run python code through VS Code. Can't open file ptvsd_launcher.py [Errno 22] Invalid Argument


VSCode was working perfectly a few days ago before this started happening. Attempting to run any python code through VSCode (with or without debugging) Results in this error in the terminal

can't open file '"c:/Users/Rastus22/.vscode/extensions/ms-python.python-2019.5.17517/pythonFiles/ptvsd_launcher.py"': [Errno 22] Invalid argument

A little after the error shows I get a message telling me there was a timeout waiting for the debugger. There aren't any errors in the python itself, currently testing with a file that contains only a print statement. My only other extension is the Darkula theme.

I've tried reinstalling the Python extension and resetting the launch.json file as well as my settings.json file. I've also tried copying over a known good copy of launch and settings file from a different machine and had no luck. I can't really seem to find anyone else online with the same issue either.


Solution

  • Downgrading to the 2019.4 fixed the issue completely. Thanks to Samuel Cooper for this answer.

    Steps to downgrade:

    1. Make sure the Python extension is installed.

    2. Hit the "manage" button on the extension.

    3. "Install another version"

    4. Search for the version you want to move to. I downgraded to version 2019.4.12954