Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot launch debug session, error in vscode pythonFiles #1010

Closed
tycode opened this issue Aug 10, 2022 · 6 comments
Closed

Cannot launch debug session, error in vscode pythonFiles #1010

tycode opened this issue Aug 10, 2022 · 6 comments

Comments

@tycode
Copy link

tycode commented Aug 10, 2022

Type: Bug

Behaviour

Expected vs. Actual

Expected behavior: starting a debug session (e.g. with F5) runs my Python module and allows me to set breakpoints, etc.

Actual behavior: starting a debug session shows a Python traceback from the VS Code Python extension (i.e. not from my code) and does not run my Python module.

The displayed traceback:

Traceback (most recent call last):
  File "c:\Users\rob\.vscode\extensions\ms-python.python-2022.12.0\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 252, in _on_run
    self.process_net_command_json(self.py_db, json_contents)
  File "c:\Users\rob\.vscode\extensions\ms-python.python-2022.12.0\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_process_net_command_json.py", line 193, in process_net_command_json
    cmd = on_request(py_db, request)
  File "c:\Users\rob\.vscode\extensions\ms-python.python-2022.12.0\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_process_net_command_json.py", line 501, in on_launch_request
    return self._handle_launch_or_attach_request(py_db, request, start_reason='launch')
  File "c:\Users\rob\.vscode\extensions\ms-python.python-2022.12.0\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_process_net_command_json.py", line 493, in _handle_launch_or_attach_request
    self._set_debug_options(py_db, request.arguments.kwargs, start_reason=start_reason)
  File "c:\Users\rob\.vscode\extensions\ms-python.python-2022.12.0\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_process_net_command_json.py", line 443, in _set_debug_options
    if os.path.isdir(f):
  File "C:\Users\rob\AppData\Local\Programs\Python\Python310\lib\genericpath.py", line 42, in isdir
    st = os.stat(s)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

I have tried a few different situations:

  • Debugging works fine in extension versions 2022.4.1, 2022.6.3, 2022.8.1
  • It doesn't work in extension versions 2022.10.0, 2022.10.1, 2022.12.0
  • When I first encountered this (which was today) I was using Python 3.7.3. I since tried using Select Interpreter to switch to Python 3.10.0 but the issue still occurs so it would not appear to be related to using an old Python version.
  • When I first encountered this, the traceback showed up within a MINGW64 shell in the integrated terminal. I thought this might have something to do with it, so changed my launch configuration to use "console": "externalTerminal", but the issue still occurs, now appearing in a Command Prompt window titled VS Code Console so it would not appear to be related to using MINGW64.

My launch.json (it's as simple as can be)

{
	"version": "0.2.0",
	"configurations": [
		{
			"name": "Python: Module",
			"type": "python",
			"request": "launch",
			"module": "launchbug",
			"console": "externalTerminal"
		}
	]
}

Inside the root folder of the workspace is a folder called launchbug containing a __main__.py containing my code.

Steps to reproduce:

  1. Create an empty folder launchbug and open the folder in VS Code
  2. Create .vscode/launch.json as above
  3. Create launchbug/__main__.py with the contents print('Hello, world!')
  4. Press Ctrl+F5 and observe Python script runs correctly
  5. Press F5 and observe error traceback (as above) instead of a debug session starting

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.0
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
  • Value of the python.languageServer setting: Pylance
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Telemetry is disabled
Experiments are disabled, only manually opted experiments are active.
LSP Notebooks experiment is disabled -- not in treatment group
LSP Notebooks interactive window support is disabled -- not in LSP Notebooks experiment
Python interpreter path: ~\AppData\Local\Programs\Python\Python310\python.exe
Starting Pylance language server.
DAP Server launched with command: C:\Users\rob\AppData\Local\Programs\Python\Python310\python.exe c:\Users\rob\.vscode\extensions\ms-python.python-2022.12.0\pythonFiles\lib\python\debugpy\adapter

User Settings


languageServer: "Pylance"

linting
• pylintArgs: "<placeholder>"

Extension version: 2022.12.0
VS Code version: Code 1.70.0 (da76f93349a72022ca4670c1b84860304616aaa2, 2022-08-04T04:38:16.462Z)
OS version: Windows_NT x64 10.0.19043
Modes:

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Aug 10, 2022
@int19h
Copy link
Contributor

int19h commented Aug 10, 2022

Sounds like a dupe of #987. We'll ship a new debugpy version with this fix soon, but until then, you can follow the steps in the linked issue to patch your local copy.

@int19h int19h closed this as completed Aug 10, 2022
@tycode
Copy link
Author

tycode commented Aug 11, 2022

Sounds like a dupe of #987. We'll ship a new debugpy version with this fix soon, but until then, you can follow the steps in the linked issue to patch your local copy.

Thanks! Didn't even realise this debugpy was a separate repo. I'll continue using 2022.8.1 until the fix is released, as this version is working fine for me.

@lambdakris
Copy link

Is there an estimate of when this fix may get released?

@int19h
Copy link
Contributor

int19h commented Aug 17, 2022

debugpy 1.6.3 has the fix. @karthiknadig, what's the plan for shipping that in vscode-python?

@karthiknadig
Copy link
Member

Should go out in a bug fix release either today or tomorrow.

@karthiknadig
Copy link
Member

This is now in release 2022.12.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants