Launch with an X Terminal
The simplest way to start a debugging session on GNU/Linux is to type winpdb in a terminal followed by the script name and it arguments. For example:
winpdb myScript.py arg1 arg2 arg3
Winpdb acts as a client and starts the debugged script in a new process that acts as a server. The new process is started either in a new X terminal or in a new screen virtual-terminal. Winpdb intentionally does not redirect IO from the debugged script process to the debugger client process.
You can also launch a debugging session from the debugger console with the launch command like this:
launch myScript.py arg1 arg2 arg3
Attach - Don’t start a New Terminal
Winpdb always uses a separate terminal for the debugged script (unless you are using the screen utility) but you can prevent Winpdb from trying to start the terminal by itself. To do this, start the debugged script server in one terminal and then have Winpdb attach to it from another terminal. To start the debugged script server use the -d command line flag. To allow the server to accept connections from remote machines add the -r flag. For example:
rpdb2 -d -r myScript.py arg1 arg2 arg3
If you have wxPython installed you can replace rpdb2 with winpdb in the above example, but as the server has no GUI it does not matter.
To attach to the debugged script server use the password, host and attach console commands in the debugger client (Winpdb). Type help in the console for more information. Alternatively you can use the GUI as described below.
Set a Password
To set the connection password click File->Password. This option is available only when the debugger is in the detached state.
Attach to a Script
To attach to a script click File->Attach. This option is available only when the debugger is in the detached state. If the attach option is selected without a password having been set, the password dialog will pop up automatically, requesting for a password. To attach to a script on a remote machine, type the machine hostname or IP address in the Host edit box and click on the Refresh button. Only scripts that match the password will show up in the dialog. Also, note that connectivity issues such as firewall protection may prevent scripts from being detected.