Breakpoint not hit from a file that was executed from another file
Answered
I have a call from inside 1 file test.py to open another file but the breakpoints are not hit on the file that is called and executed by os.system
test.py
cmd = 'python eval_single_pair.py'
os.system(cmd)
In this case the debugger should hit breakpoints set in eval_single_pair.py
Please sign in to leave a comment.
This is not supported at the moment. Please vote for the corresponding feature request https://youtrack.jetbrains.com/issue/PY-39222
It looks like it is according to help file https://www.jetbrains.com/help/pycharm/debugger-python.html
I have Attach to subprocess automatically while debugging checked.
I love Pycharm but if anyone really needs this then try Wing IDE Python https://wingware.com/
Here are the docs that show how to use Wing to debug a subprocess https://wingware.com/doc/debug/debugging-externally-launched-code
It works great. Hopefully JetBrains can add this functionality.
Hi,
This can be achieved via `subprocess` and I have tested it works. Also note the official python docs where they state that "subprocess module is intends to replace os.system and os.spawm*".
Just do
import subprocess
subprocess.run(["python" , "eval_single_pair.py"])