[Twisted-Python] Re: [Twisted-commits] Fix twistd(1) and friends on Windows.

Andrew Bennetts andrew-twisted at puzzling.org
Sat May 10 11:11:04 EDT 2003

On Sat, May 10, 2003 at 10:50:31AM -0400, Itamar Shtull-Trauring wrote:
> On Sat, 10 May 2003 09:03:41 -0500
> spiv CVS <spiv at twistedmatrix.com> wrote:
> > 
> > On Windows, twisted/script/* are run directly from batch files, rather
> > than being imported from bin/*, so the "if __name__ == '__main__':
> > run()" stanza is
> This isn't totally accurate - the stuff in bin/ is installed in
> c:\python22\scripts, and users are supposed to run them from there (eg
> c:\python22\scripts\twistd.py).

Apparently this user was just running "twistd", no path or anything like
that.  mktap and trial worked fine for them, and twistd and lore, etc
didn't.  It turned out mktap and trial have the __name__ == '__main__' test
already, and that adding that to the rest of t.scripts fixed them, too.

My understanding was that the win32 installer auto-created batch files or
something, and supplied a "Twisted Command Prompt" with them in the path.
Certainly, adding "print 'I am', __name__" to this user's
twisted/scripts/twistd.py printed "I am __main__".  They were using the
1.0.5 from the installer and Python 2.2.2 on Win 98.

I don't have a Windows install to play with, so I'm working blind here --
please fix it differently if you think there's a better way to do this.  :)


More information about the Twisted-Python mailing list