[Twisted-Python] Creating Winows Service from Twisted (2/2)

Schneider, Michael michael.l.schneider at ugsplm.com
Thu Mar 25 15:18:31 EST 2004

This is the 2nd of two mail messages on creating
a Twisted service on Windows.

One important thing to note is that the Windows service
is standalone, and no python install is required for installation.
Thanks Cory,


How to use-------------
Save this in the moonfallen dir under sandbox along with 
gen.bat from the previous email

1) run gen.bat
2) cd to subdirectory created
3) install service
4) start service
5) if service does not start, you need to add python packages to the 
   include directive.  cd to the subdirectory created in the
   moonfallen directory, edit the include directive in setup.cfg and
   execute  ..\fixup.bat (this bat file)
   repeat until finished
6) edit include portion of gen.bat, adding the python modules that
   you added during the fixup step.
7) the next time you run gen.bat, the windows installer should be
   ready to go (unless you added more python modules in your code since
   the last build).

hope this helps,
Thanks again Cory,
Michael Schneider
Senior Software Engineering Consultant
UGS PLM Solutions - an EDS Company
"The Greatest Performance Improvement Is the transitioning from a non-working state to the working state"

--------------------- fixup.bat --------------------
rem   python twisted service fixup
rem   drop this file (fixup.bat) into sandbox/moonfallen
rem  Have Fun!!!!!!!  
rem  Michael Schneider

rem  step to bring up  a service

rem 1) run tap2ntsvc  (see gen.bat file)
rem 2) install service
rem 3) If service doesn't start, or part of the application 
rem    fails with can't find module ...
rem     3a) edit setup.cvf to add the missing python module in the
rem         include section
rem     3b) run this script
rem     3c) repeat
rem 4) update gen.bat with any python modules you added in step 3
rem If you are bringing in com code, It is important to realize that
rem Microsoft uses different type libs for XP and 2000
rem You have 2 choices at this point:
rem     - use two installers (1 for each platform)
rem     - create 1 installer

rem  if you go for 2, just follow the instruction above for each
rem  installer.

rem  If you opt for 1 installer here is your steps
rem  1) select a "master" platform to create the OS
rem  2) run you test cases on this machine against the twisted
rem     application that you wish to create a servcie.
rem     This step is necessary to create the COM wrappers in
rem     wincom32/gen_py/GUI
rem  3) follow the steps above to create a service for one platform
rem     NOTE: to save you time, just go ahead and add the COM wrappers
rem           in site-packages/win32com/gen_py/{GUID}/{all
rem           wrappers}.py
rem  4) go to your other platform (XP or windows}
rem  5) run test cases on this platforms
rem  6) go to site-packages/win32com
rem  7) Notice that the GUID is the same except for the last digit
rem       {GUID}x1 for windows 2000
rem       {GUID}x2  for XP
rem  8) zip up the {GUID} dir
rem  9) copy this zip to the win32com directory of your "master"
rem     service build machine.
rem  10) unzip, creating to {GUID} dirs, with the only differces being
rem      the ending digit (x1,  or x2)
rem  11) Add these to the gen.bat (note: if 2000 is your master
rem      machine, you may not have sufficient environment variable
rem      space to pass in all includes, if this is the case
rem           11a) rebuild service for master only
rem           11b) edit setup.cfg to add com wrappers from other
rem                system
rem           11c) run this script to create a service that contains
rem                the com wrappers for both platforms
rem YOU ARE DONE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

rem  cd to service directory under moonfallen dir in sandbox
python setup.py py2exe
python do_inno_script.py
python do_inno.py

More information about the Twisted-Python mailing list