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 4444Installation 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
.
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 signalset_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.
Bertrand Janin b@janin.com - http://tamentis.com/
With contributions from (chronological, latest first):
This is inspired by:
Download filesDownload the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution Built Distribution File detailsDetails for the file rpdb-0.2.0.tar.gz
.
8346f0dd498a1c30768af3d3528cdfe8086d8c057c9fccb5430b5aec32ae16ab
MD5 4200ec41693da5990c15ab21b235bc42
BLAKE2b-256 0f872dc67e3d5a005173b2e4165bdfdeb302ef38393b16312afe70f7a252f3ae
See more details on using hashes here.
File detailsDetails for the file rpdb-0.2.0-py3-none-any.whl
.
20e59ed87bbc0ec6a89ea883d8620f26c6e0877b851a49e19c239ad2c6bd4f49
MD5 aeec73c3f53ee112ac8e9fcd98c15fd5
BLAKE2b-256 56dd39ee98f8fc0163f4df6264525fff2b87eef4b3d1a48db5936261e029ba15
See more details on using hashes here.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4