Debugging Python with GDB

To run python under gdb there are also two ways.
Interactive:

$ gdb python
...
(gdb) run <programname>.py <arguments>

Automatic:

$ gdb -ex r --args python <programname>.py <arguments>

If the process is already running, you can attach to it provided you know the process ID.

$ gdb python <pid of running process>

References
https://wiki.python.org/moin/DebuggingWithGdb