0

Update:

I just discovered that with a python 3.7 environment created with Anaconda (version number 4.11.0, which creates a python 3.7.11), this problem happens while python 3.8(.12) created by conda doesn't have this kind of problem.

And I found a solution: I use integratedTerminal in the launch.json, and without specifying terminal type, the default integrated terminal would be PowerShell which has this problem. After I change the terminal.integrated.shell.Windows setting to cmd.exe, this porlbem goes away and the problem goes through.

Original post:

I am developing a python 3.7 application on vs-code on Windows. I am using Anaconda to manage my working environments (and I have created several evns on the same dev machine). The env I am using for this app is called basic_env which is of version 3.7.10. Previously it was working fine. But today, when I returned from my 10-day holiday, and after I upgraded the vscode (to 1.64.0) and probably the python extension (version v2022.0.1786462952). The launching/debugging stopped working: a window popped up with an error mesage Timed out waiting for debuggee to spawn . I made a simple test python script using the same conda env. My script is only one line

print("test....")

And my launch.json looks like this:

{
        "name": "Python: Current File",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "integratedTerminal",
        "env": {
            "PYTHONPATH": "${workspaceFolder}"
        },
    },

The same error showed up.

I tried to google this issue, at first I thought this post was the same as my problem: using venv caused this problem, and using the system-global python didn't have this problem. So maybe the bug which was fixed 2 years ago was back along with the updates? But then I tried some other conda envs, some worked and some didn't (but none of them was of version 3.7.10). I tried to upgrade this env to 3.7.11 by:

conda activate basic_env
conda install python=3.7.11

(other existing 3.7.11 envs work fine) but the problem was still there. Also, I don't know how to get the ptvsd.adapter log file in the mentioned post. Could anyone help me track this problem?

Thank you very much!

Cheers

tete
  • 4,859
  • 11
  • 50
  • 81
  • I have the same issue. I notice there is a solution here (https://stackoverflow.com/questions/52462599/visual-studio-code-python-timeout-waiting-for-debugger-connection) but none of those worked for me. – D.L Jun 01 '22 at 17:38

1 Answers1

1

Upon reading this post I tried changing my conda env. I might have changed it a few times and tried to debug. Eventually 1 just worked. I thought maybe it was a python version, so I switched to a conda env which just a few seconds earlier hadn't worked with debugging. But this time it just worked.

I don't have an explanation as to why this worked, but if you're reading this maybe you can just try changing conda env a few times.

Update: I ran into the issue again. This time toggling conda env didn't seem to work. I did try to Run Without Debugging (which worked), and then I tried Start Debugging which to my surprise worked. Again, no answer to why, but trying to provide info which could help someone.

user3731622
  • 4,844
  • 8
  • 45
  • 84