[Twisted-Python] Windows issues...
junkster at rochester.rr.com
Mon Feb 18 21:15:41 EST 2002
on 2/18/02 7:24 PM, Andrew Bennetts at andrew-twisted at puzzling.org wrote:
>> 1) setup.py install died....It stopped when it couldn't find "CL.EXE",
>> while building
>> something in the twisted.spread.cbanana section...
> 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...
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++
(How about a precompiled Windows binary? Or having Distutils install the
>> 6) Under Windows, the default should be -n for twistd, and the PID file
>> shouldn't be created. At least, as it is now. twistd just "stops", after
>> it starts up and drops us back to the command line, and examination shows
>> that the program isn't running. So at least as a workaround, the -n mode
> 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 -->
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)
I prefer to run the console......reminds me a little bit more of a syslog
> 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
>> I guest a better question is, has twistedmatrix been tested under Windows?
>> It really seems to be unix centric in it's programming...
> It basically works. The other problem to watch out for is that
> Protocol.connectionFailed won't trigger unless you specify a timeout for
> your tcp.Client, because select works slightly differently on Windows.
> 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?
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...
> --- ServerFramework/Service.py ---
> import win32serviceutil, win32service
> """Example use of this module:
> from ServerFramework.Service import Service, main
> import ExampleServer
> class ExampleServerService(Service):
> _svc_name_ = "ExampleServerService"
> _svc_display_name_ = "My Example Server Service"
> main = ExampleServer.main
> if __name__ == '__main__':
> import twisted
> except ImportError:
> print "Twisted Python must be installed to run this service"
> class Service(win32serviceutil.ServiceFramework):
> """I am a template service for ServerFramework servers.
> You should subclass me and override the following attributes:
> _svc_name_ -- see win32serviceutil docs
> _svc_display_name_ -- see win32serviceutil docs
> main -- function that starts your server
> You can also override:
> logFile -- filename for where debug messages will be saved
> (default: c:/<_svc_name_>.log)
> _svc_name_ = "UnnamedServer"
> _svc_display_name_ = "My UNNAMED Server"
> main = None
> logFile = None
> def __init__(self, *args):
> win32serviceutil.ServiceFramework.__init__(self, *args)
> if not self.logFile:
> self.logFile = 'c:/%s.log' % (self._svc_name_,)
> def SvcDoRun(self):
> from twisted.python.log import startLogging
> # Call main, note that it is not a method of this class, so we use
> # self.main.im_func() instead of self.main().
> def SvcStop(self):
> from twisted.internet.main import shutDown
> def main(svc):
> if __name__ == '__main__':
> print "This is a library module, and should not be executed."
More information about the Twisted-Python