Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when attaching by process to python running in Maya #52

Closed
karthiknadig opened this issue Feb 20, 2020 · 4 comments
Closed

Error when attaching by process to python running in Maya #52

karthiknadig opened this issue Feb 20, 2020 · 4 comments

Comments

@karthiknadig
Copy link
Member

pydev debugger: Unable to find real location for: C:\Program Files\Autodesk\Maya2017\bin\python27.zip\ntpath.py
pydev debugger: Unable to find real location for: C:\Program Files\Autodesk\Maya2017\bin\python27.zip\genericpath.py
pydev debugger: Unable to find real location for: C:\Program Files\Autodesk\Maya2017\bin\python27.zip\ctypes\__init__.py
pydev debugger: Unable to find real location for: C:\Program Files\Autodesk\Maya2017\bin\python27.zip\threading.py
pydev debugger: Unable to find real location for: C:\Program Files\Autodesk\Maya2017\bin\python27.zip\SocketServer.py
pydev debugger: Unable to find real location for: C:\Program Files\Autodesk\Maya2017\bin\python27.zip\traceback.py
pydev debugger: Unable to find real location for: C:\Program Files\Autodesk\Maya2017\bin\python27.zip\linecache.py
Traceback (most recent call last):
  File "c:\Users\v-rokowa\.vscode\extensions\ms-python.python-2020.2.63990\pythonFiles\lib\python\new_ptvsd\no_wheels\ptvsd\server\attach_pid_injected.py", line 74, in attach
    ptvsd.attach((options.host, options.port))
  File "c:\Users\v-rokowa\.vscode\extensions\ms-python.python-2020.2.63990\pythonFiles\lib\python\new_ptvsd\no_wheels\ptvsd\__init__.py", line 109, in attach
    return api.attach(address, log_dir)
  File "c:\Users\v-rokowa\.vscode\extensions\ms-python.python-2020.2.63990\pythonFiles\lib\python\new_ptvsd\no_wheels\ptvsd\server\api.py", line 75, in debug
    raise log.exception("{0}() failed:", func.__name__, level="info")
AssertionError: Paths passed to _NormPaths must be str. Found: C:/Users/v-rokowa/Documents/maya/2017/prefs/scripts\<string> (<type 'unicode'>)
pydev debugger: Unable to find real location for: C:\Program Files\Autodesk\Maya2017\bin\python27.zip\string.py
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\Users\v-rokowa\.vscode\extensions\ms-python.python-2020.2.63990\pythonFiles\lib\python\new_ptvsd\no_wheels\ptvsd\server\attach_pid_injected.py", line 86, in attach
    raise log.exception()
AssertionError: Paths passed to _NormPaths must be str. Found: C:/Users/v-rokowa/Documents/maya/2017/prefs/scripts\<string> (<type 'unicode'>)
@int19h
Copy link
Contributor

int19h commented Feb 20, 2020

Can you add the logs, so that we can see the stack inside pydevd?

@fabioz
Copy link
Collaborator

fabioz commented Mar 7, 2020

There are 2 things there:

  1. the warnings about Unable to find real location -- this is probably correct (they probably only distribute the .pycs).

  2. the exception Paths passed to _NormPaths must be str. I'm a bit puzzled by how that happened.
    It's really strange that it got a <string> being unicode... I thought that maybe passing unicode to compile on Python 2.7 could generate that, but I haven't been able to do it here (so, I don't really know how Maya got that).

i.e.:

>>> c = compile('def method(): pass', u'<string>', 'exec')
>>> exec(c)
>>> method.func_code.co_filename
'<string>'
>>> type(method.func_code.co_filename)
<type 'str'>

@karthiknadig, is this from some user? If so, is it possible to add him to the discussion?

@fabioz
Copy link
Collaborator

fabioz commented Mar 11, 2020

Is it possible to run the snippet below inside of Maya and provide the output?

import sys
frame = sys._getframe()
attrs = ['co_filename', 'co_name', 'co_firstlineno']
while frame:
    print('---- frame info ----')
    for attr in attrs:
        value = getattr(frame.f_code, attr)
        print('%s: %s (%s)' % (attr, value, type(value)))
    frame = frame.f_back

@fabioz
Copy link
Collaborator

fabioz commented Mar 12, 2020

The issue seems to be that sys.path has a unicode entry and it's taking a path where the filename is joined with sys.path -- https://github.com/microsoft/debugpy/blob/v1.0.0b3/src/debugpy/_vendored/pydevd/pydevd_file_utils.py#L488

I'm working on a fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants