skip to Main Content

I’m running into an issue when trying to debug my Python tests in VSCode after updating to the latest version (1.93.0). Until a couple of days ago, everything was working fine, but now I keep getting a timeout error whenever I try to debug using my launch.json configuration. For context, I’m working on macOS and using Python 3.10.0.

The issue seems to be related to the debugpy extension timing out when trying to connect to the launcher. Here’s the launch.json configuration I’ve been using:

{
  // 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": "Jira_id",
      "type": "debugpy",
      "request": "launch",
      "cwd": "${workspaceFolder}/_test/acceptance/src/",
      "module": "behave",
      "env": {
        "PYTHONPATH": "${workspaceFolder}/_test/acceptance/src"
      },
      "console": "integratedTerminal",
      "args": [
        "${file}",
        "-t",
        "@jira.${selectedText}",
        "--no-skipped",
        "-D",
        "TestExecution_environment=local_es"
      ],
      "stopOnEntry": false,
      "justMyCode": false,
      "logToFile": true
    }
  ]
}

When I run my tests directly in the terminal using the following command, everything works as expected:

behave /Users/cxxx/Documents/Development/wallet-core/_test/acceptance/src/features/api/0-component/01-transactions_api/014-operations_b2m/tasks/process_inactive_accounts_kyc/success.feature -t @jira.QAWLLT-44 --no-skipped -D TestExecution_environment=local_es

I’ve also tried running the debugpy command manually, and that works too:

python -m debugpy --listen 5678 -m behave /Users/cxxx/Documents/Development/wallet-core/_test/acceptance/src/features/api/0-component/01-transactions_api/014-operations_b2m/tasks/process_inactive_accounts_kyc/success.feature -t @jira.QAWLLT-44 --no-skipped -D TestExecution_environment=local_es

However, when I attempt to run it through VSCode’s debugger, I consistently get a timeout error:
Timed out waiting for launcher to connect

However, when pointing to the debugpy launcher file:

python /Users/cxxx/.vscode/extensions/ms-python.debugpy-2024.11.2024082901-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher 57846 -- -m behave /Users/cxxx/Documents/Development/wallet-core/_test/acceptance/src/features/api/0-component/01-transactions_api/014-operations_b2m/tasks/process_inactive_accounts_kyc/success.feature -t @jira.QAWLLT-44 --no-skipped -D TestExecution_environment=local_es

I get the following error:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/Users/cxxx/.vscode/extensions/ms-python.debugpy-2024.11.2024082901-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/__main__.py", line 91, in <module>
    main()
  File "/Users/cxxx/.vscode/extensions/ms-python.debugpy-2024.11.2024082901-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/__main__.py", line 47, in main
    launcher.connect(host, port)
  File "/Users/cxxx/.vscode/extensions/ms-python.debugpy-2024.11.2024082901-darwin-arm64/bundled/libs/debugpy/launcher/../../debugpy/launcher/__init__.py", line 27, in connect
    sock.connect((host, port))
ConnectionRefusedError: [Errno 61] Connection refused

I’ve enabled logging, and the logs after attempting to execute are as follows:

I’ve tried the following steps to troubleshoot:

  1. Updated to the latest versions of both VSCode and the Python extension.
  2. Reinstalled only the necessary extensions (i.e., Python-related) and removed others.
  3. Tested manually in the terminal, and everything runs without any issues.

Despite these efforts, the issue persists in the debugger. I’ve also confirmed that all arguments are correct, and I’ve verified that VSCode is pointing to the correct Python interpreter.

Any suggestions on how to fix this? I’m completely stuck and would appreciate any help.
Even though the tests run perfectly when executed manually through the terminal, I can’t set breakpoints or debug in the same way when using the VSCode debugger. This is essential for me to inspect the flow and state during execution, but the debugger just times out.

2

Answers


  1. This also happened to me right after the recent update. Tries to launch the debugger command and timesout every single time. I haven’t figured it out yet. Is there a way to revert to a the previous VScode version?

    Login or Signup to reply.
  2. After updating to 1.94.0, Python debug runs.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search