Sometimes you do not have a nice way to control the debugger on the local machine. For example in a jupyter notebook the readline interface is horrible to use.
The debugger is designed to act as a drop-in replacement for the standard
pdb debugger. However, when starting a debug session (e.g. using
set_trace()) the debugger opens a socket and listens on the specified
interface and port for a client.
The client can either be a simple TCP socket tool (like
The debugger can be invoked by calling
A remote debugging module for the python debugger pdb
RdbClient(host: Optional[str] = None, port: Optional[int] = None)¶
netcatlike socket client that can be used as a convenience wrapper to connect to a remote debugger session.
If host or port are unspecified, they are laoded from the current
pytb.config.Configs [rdb] section
install_hook() → None¶
Installs the remote debugger as standard debugging method and calls it when using the builtin breakpoint()
set_trace(*args, host: Optional[str] = None, port: Optional[int] = None, patch_stdio: Optional[bool] = None, **kwargs) → None¶
Opens a remote PDB on the specified host and port if no session is running. If a session is already running (was started previously and a client is still connected) the session is reused instead.
Parameters: patch_stdio – When true, redirects stdout, stderr and stdin to the remote socket.