PyCharm: how to properly attach to a local process for debugging purposes
Hi 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 to a local 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:
import time
var_not_in_loop_below = 78
counter = 0
while True:
counter += 1
if counter <= 1:
dummy_text = "Dummy"
else:
dummy_text = "Dummies"
print(str(counter) + " " + dummy_text)
time.sleep(2)
loop_var = 42
I can attach to the script via Pycharm that I 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?
Thanks
[EDIT] What's going on in the cmd:
$ C:Python278python.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 in Pycharm
Attaching to a process with PID=8620
C:Python278python.exe C:UserseperretAppDataLocalJetBrainsToolboxappsPyCharm-Cch-0171.3780.115helperspydevpydevd_attach_to_processattach_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)
链接地址: http://www.djcxy.com/p/44956.html