[Twisted-Python] Running twistd and tac files as Windows service

John Aherne johnaherne at rocs.co.uk
Tue Oct 23 04:23:47 EDT 2012


I have been looking at running some twisted programs as a windows service.

So in the end I took a copy of twistd.py and adapted it to load my tac file
and run it as a windows service.

Of course the windows service will run it in a separate thread.

I now have it running on XP, 2003 Server Twisted 10 and 12 and it all
seemed fine.

However when I install it on Windows 7 I get an error

2012-10-23 07:54:49+0100 [-] Unhandled Error
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\twisted\internet\base.py", line 413,
in fireEvent
    DeferredList(beforeResults).addCallback(self._continueFiring)
  File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 297,
in addCallback
    callbackKeywords=kw)
  File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 286,
in addCallbacks
    self._runCallbacks()
  File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 542,
in _runCallbacks
    current.result = callback(current.result, *args, **kw)
--- <exception caught here> ---
  File "C:\Python27\lib\site-packages\twisted\internet\base.py", line 426,
in _continueFiring
    callable(*args, **kwargs)
  File "C:\Python27\lib\site-packages\twisted\internet\base.py", line 1153,
in _reallyStartRunning
    self._handleSignals()
  File "C:\Python27\lib\site-packages\twisted\internet\posixbase.py", line
277, in _handleSignals
    _SignalReactorMixin._handleSignals(self)
  File "C:\Python27\lib\site-packages\twisted\internet\base.py", line 1118,
in _handleSignals
    signal.signal(signal.SIGINT, self.sigInt)
exceptions.ValueError: signal only works in main thread


Looking around it would seem I need to tell the reactor
 'installsignalhandlers=0'. I am not sure if I should do this with windows
or not.

Has anyone got twistd.py to run as a service on windows because I would be
glad to know what other people have done to solve the problem.

Thanks for any info.

*John Aherne*
*
*
*
*
*
*
*www.rocs.co.uk
*
020 7223 7567
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20121023/b048786e/attachment-0001.htm 


More information about the Twisted-Python mailing list