I am using VS Code for developing in Python. I have been able to debug single test cases from the test module, which is very practical. Since recently, it no longer works. After a short waiting time, a dialog pops up: "Invalid message: Found duplicate in "env": PATH." with the buttons "Open launch.json" and "Cancel". Opening launch.json does not help, since I don't manipulate PATH there. I also did not edit PATH recently (and the message seems to point not to a wrong value in PATH, but to PATH being set multiple times).
I tried to see the duplicate PATH myself, but failed: Both echo ${env:PATH} at the console and os.environ in Python will only give a single PATH variable - as already implied by the used data structure.
I tried applying this SO answer. It does neither relate directly to VS Code, nor to duplicate PATH variables, but to duplicates in PATH, but it was the closest I found on here. It didn't work.
I had this issue when trying to debug a test function (pytest) The solution that worked for me was to ensure I had created a debug unit test in my launch.json file as recommended here.
{
"name": "Python: Debug Tests",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"purpose": ["debug-test"],
"console": "integratedTerminal",
"justMyCode": false
}
You can install different versions of the Python plugin (to whom it may concern: if this works unsatisfactorily, it may be because you have multiple instances of VS Code running). You will note:
It seems it's an issue in the latest stable version the VS Code team have solved in the meanwhile.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With