Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remote debugging of Python server with rpdb

I need to debug remote server, Python.

My Python app is running inside Docker container on some server and I have ssh access to that server.

For remote debugging I want to use rpdb (I don't know other tools for that).

My steps:

  1. enter remote server via ssh
  2. pip install rpdb
  3. add to code line import rpdb; rpdb.Rpdb(port=5555).set_trace()
  4. run ./redeploy.sh (this command will run my application)
  5. telnet 127.0.0.1 5555

As a result I get:

ubuntu@ip-10-1-0-345:~$ telnet 127.0.0.1 5555
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.

I open url which is supposed to call rpdb and I get nothing. So, how I can reach rpdb from command line then?

like image 870
v18o Avatar asked May 19 '26 13:05

v18o


1 Answers

You just need to add the addr param to the Rpdb() to accept the connections.

It'll look like this:

import rpdb; rpdb.Rpdb(addr='0.0.0.0', port=5555).set_trace()

Don't forget to add EXPOSE 5555 to your Dockerfile and map the ports on the running container.

like image 74
Marcos Vinicius Rogowski Avatar answered May 22 '26 03:05

Marcos Vinicius Rogowski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!