1.3.5 Yet Another Method of Invocation

With the caveat mentioned in 1.3.1 about problems with using pydb initially to run a script, I think most people will probably use the pydb command described in 1.1. However for completeness here we give another alternative.

Here's another way run a program under control of the debugger:

>>> import pydb
>>> import mymodule
>>> pydb.run('mymodule.test()')
(<string>:1): 
(/usr/lib/python2.4/bdb.py:366):  run
(Pydb) continue

One difference between this kind of invocation that of Section 1.1 is that statements may get executed in the import of mymodule will not be debugged. For example if mymodule implements a standalone program and/or has a __name__ = '__main__' clause, you probably don't want to use this method.

See About this document... for information on suggesting changes.