-
Notifications
You must be signed in to change notification settings - Fork 67
Debug multiprocess leads to AttributeError Can't get attribute on <module '__main__ #2108
Debug multiprocess leads to AttributeError Can't get attribute on <module '__main__ #2108
Comments
I don't have exactly the same error with the latest version, but I do have an error: The launch is:
The logs are: |
I believe this is because in a request -- Note: using plain |
@fabioz For now, you either need to use microsoft/debugpy@2d013e5 to match the public vscode-python builds, or else build the extension itself from master. |
And yes, this is likely to be an issue with sys.argv handling when debugpy is doing command line parsing. I'll investigate. |
Thanks, that does the trick for me. |
Turns out this is a quirk of When it spawns child processes, the main script is run as if '__main__' in sys.modules:
sys.modules['__mp_main__'] = sys.modules['__main__'] The problem is that it's done once in This just happens to be the case with debugpy - we import Technically I think this is rather a bug in |
Debug multiprocess leads to AttributeError Can't get attribute on <module '__main__ Don't import multiprocessing before running user code.
Debug multiprocess leads to AttributeError Can't get attribute on <module '__main__ Don't import multiprocessing before running user code. Use bytes rather than unicode for __main__.__name__ on Python 2.7.
@fabioz, it looks like
The dependency chain is pydevd -> pydevd_concurrency_analyser -> asyncio -> multiprocessing. It doesn't occur on 3.7+, probably because asyncio doesn't import multiprocessing there. Can this import be deferred? Patching up |
Thanks for the investigation. I've just fixed the part related to |
Debug multiprocess leads to AttributeError Can't get attribute on <module '__main__ Don't import multiprocessing before running user code. Use bytes rather than unicode for __main__.__name__ on Python 2.7.
Debug multiprocess leads to AttributeError Can't get attribute on <module '__main__ Don't import multiprocessing before running user code. Use bytes rather than unicode for __main__.__name__ on Python 2.7.
Environment data
Commit: c47d83b293181d9be64f27ff093689e8e7aed054
Date: 2020-02-11T14:45:59.656Z
Electron: 6.1.6
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.18363
"python.jediEnabled"
set to; more info How to update the language server to the latest stable version vscode-python#3977): truepython.languageServer
setting: MicrosoftExpected behaviour
Script should debug without any exception.
Actual behaviour
Exception at line 14 for the script bellow.
Steps to reproduce:
Debug this script.
The text was updated successfully, but these errors were encountered: