Trouble with "Attach to Process" for a Windows Service
I have a Windows Service developed with pywin32. I thought I'd try the new "Attach to Process" support in PyCharm, but couldn't get it to work.
PyCharm 4.5.4, Windows 7 x64.
First attempt
Attaching to a process with PID=13556 C:\Python33_x64\python.exe "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py" --port 49569 --pid 13556 Connecting to 64 bits target Traceback (most recent call last): File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py", line 64, in <module> main(process_command_line(sys.argv[1:])) File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py", line 61, in main setup['pid'], python_code, connect_debugger_tracing=True, show_debug_info=show_debug_info_on_target_process) File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\add_code_to_python_process.py", line 287, in run_python_code_windows assert resolve_label(process, compat.b('PyGILState_Ensure')) File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\add_code_to_python_process.py", line 252, in resolve_label assert address AssertionError
I noticed that it was finding the Python 3.3 installation on my machine and running with that rather than the interpreter configured for the current project (maybe a bug?). So I uninstalled Python 3.3.
Second attempt
Attaching to a process with PID=13556 C:\Users\eric.smith\Envs\spx\Scripts\python.exe "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py" --port 49707 --pid 13556 Connecting to 64 bits target Traceback (most recent call last): File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py", line 64, in <module> main(process_command_line(sys.argv[1:])) File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py", line 61, in main setup['pid'], python_code, connect_debugger_tracing=True, show_debug_info=show_debug_info_on_target_process) File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\add_code_to_python_process.py", line 287, in run_python_code_windows assert resolve_label(process, compat.b('PyGILState_Ensure')) File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\add_code_to_python_process.py", line 256, in resolve_label process.scan_modules() File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\winappdbg\module.py", line 1061, in scan_modules dwProcessId) as hSnapshot: File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\winappdbg\win32\kernel32.py", line 4207, in CreateToolhelp32Snapshot raise ctypes.WinError() WindowsError: [Error 5] Access is denied.
It found my project interpreter this time, which seems good, but still eventually failed.
I'm running PyCharm "As Administrator", so I hoped that permissions wouldn't be an issue attaching to a service. Maybe that's not the issue at all.
Any suggestions?
Thanks,
Eric
PyCharm 4.5.4, Windows 7 x64.
First attempt
Attaching to a process with PID=13556 C:\Python33_x64\python.exe "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py" --port 49569 --pid 13556 Connecting to 64 bits target Traceback (most recent call last): File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py", line 64, in <module> main(process_command_line(sys.argv[1:])) File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py", line 61, in main setup['pid'], python_code, connect_debugger_tracing=True, show_debug_info=show_debug_info_on_target_process) File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\add_code_to_python_process.py", line 287, in run_python_code_windows assert resolve_label(process, compat.b('PyGILState_Ensure')) File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\add_code_to_python_process.py", line 252, in resolve_label assert address AssertionError
I noticed that it was finding the Python 3.3 installation on my machine and running with that rather than the interpreter configured for the current project (maybe a bug?). So I uninstalled Python 3.3.
Second attempt
Attaching to a process with PID=13556 C:\Users\eric.smith\Envs\spx\Scripts\python.exe "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py" --port 49707 --pid 13556 Connecting to 64 bits target Traceback (most recent call last): File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py", line 64, in <module> main(process_command_line(sys.argv[1:])) File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py", line 61, in main setup['pid'], python_code, connect_debugger_tracing=True, show_debug_info=show_debug_info_on_target_process) File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\add_code_to_python_process.py", line 287, in run_python_code_windows assert resolve_label(process, compat.b('PyGILState_Ensure')) File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\add_code_to_python_process.py", line 256, in resolve_label process.scan_modules() File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\winappdbg\module.py", line 1061, in scan_modules dwProcessId) as hSnapshot: File "C:\Program Files (x86)\JetBrains\PyCharm 4.5\helpers\pydev\pydevd_attach_to_process\winappdbg\win32\kernel32.py", line 4207, in CreateToolhelp32Snapshot raise ctypes.WinError() WindowsError: [Error 5] Access is denied.
It found my project interpreter this time, which seems good, but still eventually failed.
I'm running PyCharm "As Administrator", so I hoped that permissions wouldn't be an issue attaching to a service. Maybe that's not the issue at all.
Any suggestions?
Thanks,
Eric
Please sign in to leave a comment.