[Twisted-Python] Windows issues...

Andrew Bennetts andrew at puzzling.org
Mon Feb 18 21:55:43 EST 2002

On Mon, Feb 18, 2002 at 09:15:41PM -0500, Benjamin Schollnick wrote:
> on 2/18/02 7:24 PM, Andrew Bennetts at andrew-twisted at puzzling.org wrote:
> > CL.EXE is a command line program that comes with MS Visual C++...  setup.py
> > is basically trying to compile a C extension module.  I can send you a
> > binary for that file if you don't have MS VC++ installed, otherwise run
> > VCVARS32.BAT and try again.
> No Visual C++....
> If you don't mind sending it, I would appreciate it...

I'll send it in a private mail.  It's compiled for Python 2.2 on Win2k; it
should be portable to any Win32, but I'm just guessing about that.

> This really needs to be noted.... I admit, I didn't search around too
> much, but I didn't see anything mentioning that it required a C/C++
> compiler...
> (How about a precompiled Windows binary?  Or having Distutils install the
> precompiled binary)....

I *think* what's supposed to happen is for it to fallback to a pure Python
implementation.  It's part of the twisted.spread package; if you're not
using spreadable computing, it doesn't really matter anyway.

> > Yeah, -n uses os.fork, which is not available under Windows.  You probably
> > need to use NT services instead...
> That's what I figured....
> (By NT Services, you mean the services listed from control panels -->
> services?)


> But I dislike the NT services.... I've never seen a service get installed,
> that will "uninstall" properly...  (Usually add/remove program doesn't
> uninstall the service)

These ones will :)

If you've got an ExampleService.py which contains the example below, you can
  ExampleService.py install
  ExampleService.py start
  ExampleService.py stop
  ExampleService.py remove

As well as the usual stuff in the control panel... see the docs for the
win32serviceutil module for details.

> I prefer to run the console......reminds me a little bit more of a syslog
> window... >g<

Yeah, but that requires you to be logged in for your server to run.  But I
know what you mean.

Have you seen simpleserv.py in the docs/example directory that came with
Twisted?  It doesn't require mktap or twistd, it just runs standalone -- my
servers all run like that, or optionally as a service via that module I
posted below.  I generally debug them by running them at the command line,
and then install them as a service when I think they're ready to run without
me needing to watch them :)

> > Alternatively, consider using the cygwin version of Python -- it is closer
> > to the unix version, and so os.fork will work.  Also, it comes with gcc, so
> > cbanana would compile correctly.  Unfortunately, I don't think it can
> > interoperate with the Win32 extensions (at least, not that I know of).
> I use the Win32 services, include ODBC... So that's not really a useable
> workaround...

Yeah.  Are you using ODBC via COM (i.e. by calling
win32com.client.Dispatch("ADODB.Connection"))?  If so, you will probably
want to use the mx.ODBC library with Twisted instead, as it can
automatically work with the twisted.enterprise stuff (with a tiny amount of

> > Incidentally, I'm not using the twistd stuff *at all* (I don't yet
> > understand the need for it under Windows, but then I don't even know exactly
> > what it's meant to do...).  Instead, I'm using this little file:
> Is the following code "temporary"....  It's considered a service while
> running, but doesn't get installed in the services control panel?

No, it's a full-blown service.  It can be installed as a service, it can be
set to start a startup, etc.

> It looks interesting, but I don't want to register the app as a "true"
> service... As I mentioned before, I can't find a reliable way to remove
> a service, without registry hacking...

Don't worry, that's already taken care of... this is Python, it plays nice

I'll be happy to elaborate further on any of this if you like.  Perhaps I
should whip up an example of installing and using simpleserv.py as a


More information about the Twisted-Python mailing list