Open DudeNr33 opened 3 months ago
I know there also exists https://github.com/microsoft/vscode-python/issues/10722, but as the debugger is now a separate extension I was not sure if this should now be handled in this repo?
I tried to reproduce this issue on a second Windows machine (Windows 11), but there it worked fine. The problem occurs on my work laptop with Windows 10.
What I also tried so far:
settings.json
: no successThere is no .env
file in the workspace:
C:.
│ test_something.py
│
├───.vscode
│ settings.json
│
└───__pycache__
test_something.cpython-38.pyc
For reference, here is my full user settings.json
:
```json { "workbench.startupEditor": "none", "workbench.editorAssociations": { "*.ipynb": "jupyter-notebook" }, "notebook.cellToolbarLocation": { "default": "right", "jupyter-notebook": "left" }, "terminal.integrated.defaultProfile.windows": "Command Prompt", "cmake.configureOnOpen": false, "csharp.suppressDotnetInstallWarning": true, "python.formatting.provider": "black", "[python]": { "editor.defaultFormatter": "ms-python.black-formatter", "editor.formatOnType": true }, "files.exclude": { "**/__pycache__": true, "**/*.pyc": true }, "testOnSave.testCommand": "", "python.defaultInterpreterPath": "C:\\Python38\\Scripts\\python.exe", "explorer.confirmDragAndDrop": false, "editor.formatOnSave": true, "workbench.iconTheme": "vscode-icons", "plantuml.server": "...", "plantuml.render": "PlantUMLServer", "remote.SSH.remotePlatform": { "dev-ec2": "linux", "ssm-dev-ec2": "linux" }, "redhat.telemetry.enabled": false, "vsicons.dontShowNewVersionMessage": true, "java.configuration.runtimes": [ { "name": "...", "path": "..." } ], "maven.settingsFile": "C:\\ProgramData\\chocolatey\\lib\\maven\\apache-maven-3.8.6\\conf\\settings.xml", "java.configuration.maven.userSettings": "C:\\ProgramData\\chocolatey\\lib\\maven\\apache-maven-3.8.7\\conf\\settings.xml", "testOnSave.languageId": "", "editor.stickyScroll.enabled": true, "git.autofetch": true, "markdown.validate.enabled": true, "git.confirmSync": false, "eslint.workingDirectories": ["frontend"], "workbench.colorTheme": "Default Dark+", "prettier.printWidth": 160, "[html]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "sonarlint.rules": { "python:S107": { "level": "off" } }, "java.configuration.maven.globalSettings": "C:\\ProgramData\\chocolatey\\lib\\maven\\apache-maven-3.8.7\\conf\\settings.xml", "java.configuration.updateBuildConfiguration": "automatic", "boot-java.rewrite.reconcile": true, "java.format.settings.url": "...", "[json]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "maven.terminal.useJavaHome": true, "explorer.confirmDelete": false, "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "prettier.singleQuote": true, "pylint.importStrategy": "fromEnvironment", "editor.renderWhitespace": "trailing", "robot.variables": {}, "editor.guides.bracketPairs": "active", "editor.detectIndentation": false, "window.zoomLevel": -1, "[markdown]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "jupyter.askForKernelRestart": false, "[jsonc]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "robot.completions.keywords.prefixImportName": true, "continue.telemetryEnabled": false, "continue.enableTabAutocomplete": false, "mypy-type-checker.importStrategy": "fromEnvironment", "mypy-type-checker.args": ["--ignore-missing-imports", "--implicit-optional"], "accessibility.signals.terminalQuickFix": { "sound": "on" }, "markdownlint.config": { "MD024": { "siblings_only": true } }, "python.experiments.enabled": false } ```
In addition, the config setting for Python: Env File
is set to: ${workspaceFolder}/.env
(both in User and in Workspace settings).
If there is any additional information that I can provide to help find the root cause, please let me know.
With the following launch.json
debugging works:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Debug Test",
"purpose": ["debug-test"],
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
Changing console
to internalConsole
makes the issue reappear.
Shouldn't this have been fixed via https://github.com/microsoft/vscode-python/pull/21033?
Type: Bug
Plugin Versions
Python: v2024.2.1 Python Debugger: v2024.2.0
Behaviour
Expected vs. Actual
Expected: When selecting "debug test" from test runner or the editor, the debugger should start.
Actual: Debugger fails to start. Popup dialog with message "Invalid message: Found duplicate in "env": PATH." is displayed.
Steps to reproduce:
class SomeTest(unittest.TestCase): def test_anything(self): self.assertTrue(True)
2024-03-12 17:28:25.416 [debug] Found cached env for C:\Python38\python.exe 2024-03-12 17:28:25.421 [debug] starting server as TCP 2024-03-12 17:28:25.421 [debug] starting server as TCP 2024-03-12 17:28:25.423 [info] Using launch configuration in workspace folder. 2024-03-12 17:28:25.423 [debug] Found cached env for C:\Python38\python.exe 2024-03-12 17:28:25.423 [debug] Found cached env for C:\Python38\python.exe 2024-03-12 17:28:25.464 [debug] Activation Commands received undefined for shell cmd, resource c:\UserData\z003emnm\temp\duplicate_env_repro\test1 and interpreter C:\Python38\python.exe 2024-03-12 17:28:25.472 [debug] Found cached env for C:\Python38\python.exe 2024-03-12 17:28:25.473 [debug] Found cached env for C:\Python38\python.exe 2024-03-12 17:28:25.473 [debug] Found cached env for C:\Python38\python.exe 2024-03-12 17:28:25.478 [debug] CreateEnv Trigger - turned off in settings 2024-03-12 17:28:25.616 [debug] Found cached env for C:\Python38\python.exe 2024-03-12 17:28:25.634 [debug] Extension ms-python.debugpy accessed getActiveEnvironmentPath with args: undefined 2024-03-12 17:28:25.639 [debug] Extension ms-python.debugpy accessed resolveEnvironment with args: {"id":"C:\PYTHON38\PYTHON.EXE","path":"C:\Python38\python.exe"} 2024-03-12 17:28:25.647 [debug] Found cached env for C:\Python38\python.exe 2024-03-12 17:28:25.668 [debug] Extension ms-python.debugpy accessed resolveEnvironment with args: "C:\Python38\python.exe" 2024-03-12 17:29:10.882 [debug] Clearing context for python dependencies not installed: ms-python.python.Python 2024-03-12 17:29:10.883 [debug] Found cached env for C:\Python38\python.exe
2024-03-12 17:26:32.337 [info] Name: Python Debugger 2024-03-12 17:26:32.337 [info] Module: debugpy 2024-03-12 17:27:29.664 [info] DAP Server launched with command: C:\Python38\python.exe c:\Users\z003emnm.vscode\extensions\ms-python.debugpy-2024.2.0-win32-x64\bundled\libs\debugpy\adapter 2024-03-12 17:28:25.647 [info] DAP Server launched with command: C:\Python38\python.exe c:\Users\z003emnm.vscode\extensions\ms-python.debugpy-2024.2.0-win32-x64\bundled\libs\debugpy\adapter
languageServer: "Pylance"
testing • unittestArgs: ["-v", "-s", ".", "-p", "test_*.py"] • unittestEnabled: true
experiments • enabled: false
vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscoreces:30445986 vscod805cf:30301675 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:30899288 c4g48928:30535728 azure-dev_surveyone:30548225 vscrp:30673768 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 pythontbext0:30879054 accentitlementsc:30887149 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 pydisww1:30981707 cppperfcontrol:30979541 8082a590:30971561 fegfb526:30981948 bg6jg535:30979843 dsvsc020:30976470