To run python under gdb there are also two ways.
$ gdb python ... (gdb) run <programname>.py <arguments>
$ 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>