Some times you need to debug python code which is executed by another process and and in this cases
rpdb comes in handy.
rpdb is a wrapper around pdb that re-routes stdin and stdout to a socket handler. By default it opens the debugger on port 4444
# In the Python file you want to debug. import rpdb rpdb.set_trace()
And then you need run this in terminal to connect to this process.
# Call in a terminal to see the output $ nc 127.0.0.1 4444
And you will get pdb promt
> /home/usr/ook.py(3)<module>() -> print("Hello world!") (Pdb)