Skip to content

Adapter times out when running from Maya  #334

Closed

Description

@luabud
import cube
# Error: RuntimeError: file C:\Program Files\Autodesk\Maya2020\Python\lib\site-packages\debugpy\server\api.py line 224: timed out waiting for adapter to connect # 

cube.py:

import maya.cmds as mc
import debugpy 
import time

#while debugpy.is_client_connected():
#    time.sleep(0.5)

debugpy.listen(("localhost",5678))
debugpy.wait_for_client()

debugpy.breakpoint()
r = mc.polyCube(w=2,h=9,d=2)

debugpy.breakpoint()
print("hey!")

Run selection for "import cube"

Activity

  1. fabioz commented on Jul 16, 2020

    @fabioz
    Collaborator

    I don't really have Maya to test and it seems to work for me in the usual attach to port 5678... Do you know which Python version is Maya using?

    One thing to try: replace localhost with 127.0.0.1 (both in the launch and in debugpy.listen).

    If it doesn't work, please provide the logs (from Maya and from VSCode).

    To get the logs from Maya, you should be able to do something as:

    import debugpy
    debugpy.log_to('c:/temp')
    

    To get the logs from VSCode:

    • Open VS Code
    • Select the command Extensions: Open Extensions Folder
    • Locate the Python extension directory, typically of the form ms-python.python-2020..***
    • In that directory ensure you do not have any debug*.log files, if you do, please delete them
    • Go back into VS Code and modify your launch.json to add the setting "logToFile": true to the attach, see below:
    "version": "0.2.0",
    "configurations": [
            {
                "name": "Python Attach to 5678",
                "type": "python",
                "request": "attach",
                "port": 5678,
                "host": "127.0.0.1",
                "logToFile": true,
            },```
    
    * Start debugging
    * When done, go back into the extension directory and upload the debug*.log files into this GitHub issue.
    
    
  2. int19h commented on Jul 16, 2020

    @int19h
    Contributor

    We had a collaborative debug session about this, and it's pretty complicated (there are various things that seem to not work in Maya). I'll investigate it further.

  3. fabioz commented on Jul 16, 2020

    @fabioz
    Collaborator

    As a note, I believe that plain pydevd does work in Maya using the remote attach (from reports I got in the past), so, my hunch is that this is related to launching the secondary adapter process/connecting to it, but if it turns out you need something on the pydevd side, please let me know.

  4. luabud commented on Jul 20, 2020

    @luabud
    MemberAuthor

    FWIW Maya uses Python 2.7 😅 and I manually added debugpy to site-packages because they seem to use some sort of custom Python.

  5. munkybutt commented on Jul 28, 2020

    @munkybutt

    Are there any updates on this?
    I am having the same problem in 3DsMax using debugpy where as pydevd used to work without issue.

  6. daniele-niero commented on Jul 30, 2020

    @daniele-niero

    Same here

  7. added
    bug
    on Aug 13, 2020
  8. bob-white commented on Aug 25, 2020

    @bob-white
    Contributor

    I'm running into a similar problem with our own application that embeds python.
    The issue seems to be that debugpy.listen spawns a subprocess using sys.executable which will fail for Maya/Max/Our Tool. Because these aren't standard python processes that accept standard python arguments.

    It would be nice if we could specify a python-process instead.

    In fact, just changing sys.executable in the listen function to 'python' was enough for me to get vs_code to connect properly. Not sure how true this is for other programs, I haven't tested Max/Maya.

  9. RockShea commented on Aug 25, 2020

    @RockShea

    I was considering the same approach, pointing it at the Max specific python exe.
    Haven't had a chance to test yet.
    If it is possible, it would be great to have this be exposed as a setting.

  10. int19h commented on Aug 25, 2020

    @int19h
    Contributor

    Ah, that makes sense! It would be #262, then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions