Critical: Debug the python script that is invoked by shell script

There is shell script file with  example.sh, which invokes python file in it. I need to debug the python file(new_file.py).
When I set the breakpoints in python file and run the shell script(which calls new_file.py file), the debugger doesn't work, instead it executes the whole python file without stopping at breakpoints. Any solution to debug?

 

0
5 comments

Any update please?

 

0

Mikhail Tarabrikov No. I have a separate code with the above setup. I need to run shell script first and then it invokes python file. So I need a way to debug the python code. Can you give me possible solutions?

0

Any update on the solution?

0

Laxmitg1994 , apologies for the delay. You can try Python debug server configuration then:

0. Start Python Debug Server configuration which will wait for connections

1. Install pydevd-pycharm in the interpreter used to run newfile.py 

2. Inside newfile.py add

import pydevd_pycharm
pydevd_pycharm.settrace('localhost', port=12345, stdoutToServer=True, stderrToServer=True)

(adjust port as deeded)

3. Start example.sh which will call newfile.py and connect to debug server and then pause on breakpoint

0

Please sign in to leave a comment.