rpdb - remote debugger based on pdb
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:
import rpdb; rpdb.set_trace()
But you can change that by simply instantiating Rpdb manually:
import rpdb
debugger = rpdb.Rpdb(port=12345)
debugger.set_trace()
It is known to work on Jython 2.5 to 2.7, Python 2.5 to 3.1. It was written originally for Jython since this is pretty much the only way to debug it when running it on Tomcat.
Upon reaching set_trace(), your script will "hang" and the only way to get it
to continue is to access rpdb using telnet, netcat, etc..:
nc 127.0.0.1 4444
Installation in CPython (standard Python)
pip install rpdb
For a quick, ad hoc alternative, you can copy the entire rpdb subdirectory
(the directory directly containing the init.py file) to somewhere on your
$PYTHONPATH.
Installation in a Tomcat webapp
Just copy the rpdb directory (the one with the init.py file) in your WEB-INF/lib/Lib folder along with the standard Jython library (required).
Trigger rpdb with signal
set_trace() can be triggered at any time by using the TRAP signal handler.
This allows you to debug a running process independently of a specific failure
or breakpoint:
import rpdb
rpdb.handle_trap()
# As with set_trace, you can optionally specify addr and port
rpdb.handle_trap("0.0.0.0", 54321)
Calling handle_trap will overwrite the existing handler for SIGTRAP if one has
already been defined in your application.
Known bugs
- The socket is not always closed properly so you will need to ^C in netcat and Esc+q in telnet to exit after a continue or quit.
- There is a bug in Jython 2.5/pdb that causes rpdb to stop on ghost breakpoints after you continue ('c'), this is fixed in 2.7b1.
Author(s)
Bertrand Janin b@janin.com - http://tamentis.com/
With contributions from (chronological, latest first):
- Cameron Davidson-Pilon - @CamDavidsonPilon
- Pavel Fux - @fuxpavel
- Ken Manheimer - @kenmanheimer
- Steven Willis - @onlynone
- Jorge Niedbalski R niedbalski@gmail.com
- Cyprien Le Pannérer clepannerer@edd.fr
- k4ml kamal.mustafa@gmail.com
- Sean M. Collins sean@coreitpro.com
- Sean Myers sean.myers@redhat.com
This is inspired by:
Metadata
Release files for rpdb 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rpdb-0.2.0.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rpdb-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.5 kB
Release files / rpdb-0.2.0.tar.gz
| Download URL | rpdb-0.2.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8346f0dd498a1c30768af3d3528cdfe8086d8c057c9fccb5430b5aec32ae16ab
|
|
BLAKE2b-256 checksum How to use checksums |
0f872dc67e3d5a005173b2e4165bdfdeb302ef38393b16312afe70f7a252f3ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.13.1 Darwin/24.1.0
|
Release files / rpdb-0.2.0-py3-none-any.whl
| Download URL | rpdb-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20e59ed87bbc0ec6a89ea883d8620f26c6e0877b851a49e19c239ad2c6bd4f49
|
|
BLAKE2b-256 checksum How to use checksums |
56dd39ee98f8fc0163f4df6264525fff2b87eef4b3d1a48db5936261e029ba15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.13.1 Darwin/24.1.0
|