Skip to content

[Investigate] Remote attach without launching adapter subprocess #532

@RockShea

Description

@RockShea

Environment data

  • debugpy version: 1.2.1
  • OS and version: Windows 10 Pro
  • Python version (& distribution if applicable, e.g. Anaconda): Python27 embedded into 3DsMax 2018
  • Using VS Code or Visual Studio: VSCode

Actual behavior

Remote attach times out from 3DsMax 2018 - which runs embedded Python27.
Here is the stacktrace, from 3DsMax 2018:

Traceback (most recent call last):
  File "C:\p4\Tools\Art\Python\!Shared\Development\R_Shared\R_Debugger.py", line 27, in start
    debugpy.listen(inAddress)
  File "C:\p4\Tools\Python\environment\2.7\Lib\site-packages\debugpy\__init__.py", line 113, in listen
    return api.listen(address)
  File "C:\p4\Tools\Python\environment\2.7\Lib\site-packages\debugpy\server\api.py", line 143, in debug
    log.reraise_exception("{0}() failed:", func.__name__, level="info")
  File "C:\p4\Tools\Python\environment\2.7\Lib\site-packages\debugpy\server\api.py", line 141, in debug
    return func(address, settrace_kwargs, **kwargs)
  File "C:\p4\Tools\Python\environment\2.7\Lib\site-packages\debugpy\server\api.py", line 232, in listen
    raise RuntimeError("timed out waiting for adapter to connect")
RuntimeError: timed out waiting for adapter to connect

And the error message in VSCode:
image

Expected behavior

Remote attach to correctly connect, as it does with 3DsMax 2021 - which runs embedded Python 37.

Steps to reproduce:

VSCode config settings which work in 3DsMax 2021 - Python37, but not 3DsMax 2018 - Python27:

"configurations": [
    {
        "name": "Python: Remote Attach",
        "type": "python",
        "request": "attach",
        "port": 3000,
        "host": "0.0.0.0",
        "pathMappings": [
            {
                "localRoot": "C:/p4/Tools/Art/Python",
                "remoteRoot": "C:/p4/Tools/Art/Python"
            }
        ]
    },
}

Code to run within 3DsMax, which works in 2021 - Python37 and not 2018 - Python27:

import debugpy
import os
import traceback


def start(inAddress, waitForAttach=False):

    try:

        debugpy.configure(python=<externalPythonPath>)
        debugpy.listen(inAddress)
        if waitForAttach:

            print("Waiting for debugger to attach...")
            debugpy.wait_for_client()

    except Exception:

        traceback.print_exc()


def stop():

    return


if __name__ in ("__main__", "__builtin__"):

    start(("0.0.0.0", 3000), waitForAttach=False)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions