Pycharm: How to properly attach to a local process for debugging purposes?
Hello,
I am facing some issues when trying debug a process I have attached following the document available for PyCharm here:https://www.jetbrains.com/help/pycharm/2017.1/attaching-to-local-process.html I would like to attach PyCharm to a local python process for debugging purposes.
|
So I just wrote some dummy code in my running.py file without any real-world purpose just for the sake of the demonstration:
|
Then I can attach Pycharm to the my running Python script that I just started in a windows cmd: python running.py
However, PyCharm just shows what it's actually printed in the console part without me being able to step in any sort of fashion in source code available in Pycharm, any idea about why I cannot step or debug my code when adding a breakpoint while the interpreter is running the script in the cmd right beside the IDE?
Below is what going on in cmd:
$ C:\Python278\python.exe running.py
1 Dummy
2 Dummies
3 Dummies
4 Dummies
5 Dummies
6 Dummies
7 Dummies
8 Dummies
9 Dummies
10 Dummies
11 Dummies
12 Dummies
13 Dummies
14 Dummies
15 Dummies
16 Dummies
And here, in Pycharm:
Attaching to a process with PID=8620
C:\Python278\python.exe C:\Users\eperret\AppData\Local\JetBrains\Toolbox\apps\PyCharm-C\ch-0\171.3780.115\helpers\pydev\pydevd_attach_to_process\attach_pydevd.py --port 62090 --pid 8620
Connecting to 32 bits target
Injecting dll
Dll injected
Allocating code in target process
Writing code in target process
Allocating return value memory in target process
Injecting code to target process
Waiting for code to complete
Connected to pydev debugger (build 171.3780.115)
Error when injecting code in target process. Error code: 7 (on windows)
10 Dummies
11 Dummies
12 Dummies
13 Dummies
14 Dummies
15 Dummies
16 Dummies
Wondering whether the issue is related to this line below:
Error when injecting code in target process. Error code: 7 (on windows)
But I don't really know what can I do in that regard.
I tried and check whether there was a zombie process or some kind of leftover of a running script that I would have interrupted but nothing wrong on that side.
This post is actually duplicated from another post (still mine) on SO: http://stackoverflow.com/questions/43213094/pycharm-how-to-properly-attach-to-a-local-process-for-debugging-purposes?noredirect=1#comment73499303_43213094
Any idea?
Thanks
Please sign in to leave a comment.
Hi! Please vote for the ticket in our issue tracker: https://youtrack.jetbrains.com/issue/PY-17986