[Twisted-Python] Debugging client programs
Itamar Shtull-Trauring
itamar at itamarst.org
Wed Jul 30 10:26:44 MDT 2003
On 30 Jul 2003 15:45:20 -0000
Moshe Zadka <m at moshez.org> wrote:
> On Wed, 30 Jul 2003, John Goerzen <jgoerzen at complete.org> wrote:
>
> > However, my program is a client program, and thus does not run under
> > twistd, has no TAP, etc. What is the framework for enabling
> > debugging for that? And could it be documented in the howto?
>
> You are deluded.
> There is absolutely no excuse not to run with twistd. There is no need
> for a TAP file: a .tac file (that is, a Python file which defines a
> variable named Application) would do just as well. Then, twistd -bony
> file.tac, and presto! debuggy goodness.
To rephrase, just make a python file with a t.i.app.Application instance
called "application" on the module level. See
http://itamarst.org/writings/OSCON03/twisted_internet-129.html for
details.
twistd can be used just as well for both client and server apps,
although it is most useful for server apps.
You can also, as with *any* regular python script, run "python
/usr/lib/python2.2/pdb.py yourscript.py" on any runnable python script
you have, without making any changes to it. This won't enable one
feature that twistd gives (automatic post-mortem debugging of
exceptions), but is good enough for many cases.
--
Itamar Shtull-Trauring http://itamarst.org/
http://www.zoteca.com -- Python & Twisted consulting
More information about the Twisted-Python
mailing list