[Twisted-Python] Running twisted tap file as NT service

Cory Dodt corydodt at twistedmatrix.com
Fri Jan 30 10:41:59 MST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tap2ntsvc creates a package structured like the following:

+-----------------------------------------------+
|   inno setup installer                        |
|      +--------------------------------+       |
|      |     py2exe'd executable        |       |
|      |        +-----------------+     |       |
|      |        |  your app  code |     |       |
|      |        +-----------------+     |       |
|      |                                |       |
|      +--------------------------------+       |
|                                               |
+-----------------------------------------------+

The py2exe'd executable is dynamically linked with pythonxx.dll, which is in
your directory.  (It's just a stub attached to a zip file; the stub runs
python on the zipped modules.  You can actually open it with winzip etc.)

The output, that -setup.exe, can be run on the machine where you want the
service, and it will (by default) place the py2exe stuff and whatever data
files you added to gridnode.fms in C:\program files\gridnode.  It will also
install the service as the first operation.

If you remembered all your includes when you built, all you need is the setup
executable and you have a fully functioning service.  Start it with "net start
gridnode" from the command line or Start>Settings>ControlPanel>Services>select
gridnode and click start, or just reboot.

Be sure to check the event logs when you do; it sometimes takes several
attempts before you collect all the modules py2exe didn't find on its own.

(Incidentally, psloglist is the best way to do this from the command line:
http://www.sysinternals.com/ntw2k/freeware/psloglist.shtml.)

C




Schneider, Michael wrote:

| Thanks for the guide.
|
| I am able to create a ntservice .exe, attached is the command that
| I used, and the output.
|
| My application is in the gridnode package, and it depends on twisted
| and standard python.
|
|
| Really Stupid question time. I have very little expericence with
| deploying windows services.
|
| What do I do next to install this?
| Since you leverage py2exe, does python need to be installed on the
| machines (I am rolling this out to several hundred machines, and
| python is not installed on those machine at this time)?
|
|
|
| Thank you very much for your work on this tool!!!!!!!!!!!!!!
|
| Mike
| ------------------- Command and Command Output
|
| D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen>python tap2ntsvc
- --name="gridnoded" --display_name=gridnoded --disp
| lay_name="Grid Node Service" --type=pickle --include=gridnode
d:\grid\gridnoded.tap
|
|
|
| C:\Python23\Lib\site-packages\py2exe\build_exe.py:992: DeprecationWarning:
Non-ASCII character '\xa9' in file C:\Python2
| 3\Lib\site-packages\py2exe\resources\VersionInfo.py on line 226, but no
encoding declared; see http://www.python.org/pep
| s/pep-0263.html for details
|   from resources.VersionInfo import VS_VERSIONINFO, RT_VERSION, \
| C:\Python23\Lib\site-packages\py2exe\resources\VersionInfo.py:70:
FutureWarning: hex/oct constants > sys.maxint will ret
| urn positive values in Python 2.4 and up
|   dwSignature = 0xFEEF04BD
| warning: py2exe: could not parse version number ''
|   No VersionInfo will be created
| warning: py2exe:
*************************************************************************
| warning: py2exe: * The following modules were not found:
| warning: py2exe: *   Carbon.Folder
| warning: py2exe: *   Carbon.Folders
| warning: py2exe: *   Crypto.Cipher
| warning: py2exe: *   OpenSSL
| warning: py2exe: *   SOCKS
| warning: py2exe: *   _ssl
| warning: py2exe: *   _xmlplus
| warning: py2exe: *   _xmlrpclib
| warning: py2exe: *   fcntl
| warning: py2exe: *   grp
| warning: py2exe: *   ic
| warning: py2exe: *   jarray
| warning: py2exe: *   java.io.IOException
| warning: py2exe: *   java.io.InterruptedIOException
| warning: py2exe: *   java.net
| warning: py2exe: *   readline
| warning: py2exe: *   rourl2path
| warning: py2exe: *   sgi
| warning: py2exe: *   sgmlop
| warning: py2exe:
*************************************************************************
| Built File dist\gridnodedsvc\gridnodedsvc.exe
| Created gridnoded.fms
| Inno Setup 4 Command-Line Compiler
| Copyright (C) 1998-2003 Jordan Russell. All rights reserved.
| Portions by Martijn Laan
|
| Compiler engine version: Inno Setup 4.0.9
|
| Reading [Setup] section, line 18
| Reading [Setup] section, line 19
| Reading [Setup] section, line 20
| Reading [Setup] section, line 21
| Reading [Setup] section, line 22
| Reading [Setup] section, line 23
| Reading file (WizardImage)
|    File: C:\Python23\Lib\site-packages\inno\program\WIZMODERNIMAGE.BMP
| Reading file (WizardSmallImage)
|    File: C:\Python23\Lib\site-packages\inno\program\WIZMODERNSMALLIMAGE.BMP
| Reading [LangOptions] and [Messages] sections
|    File: C:\Python23\Lib\site-packages\inno\program\DEFAULT.ISL
|    Messages in script file
| Reading [Code] section
| Reading [Dirs] section, line 16
| Reading [Icons] section, line 25
| Reading [Run] section, line 27
| Reading [Run] section, line 28
| Reading [UninstallRun] section, line 30
| Reading [UninstallRun] section, line 31
|    Reading version info: C:\Python23\Lib\site-packages\inno\program\UNINST.E32
| Reading [Files] section, line 2
| Reading [Files] section, line 3
| Reading [Files] section, line 4
| Reading [Files] section, line 5
| Reading [Files] section, line 6
| Reading [Files] section, line 7
| Reading [Files] section, line 8
| Reading [Files] section, line 9
| Reading [Files] section, line 10
| Reading [Files] section, line 11
| Reading [Files] section, line 12
| Reading [Files] section, line 13
| Reading [Files] section, line 14
| Creating setup files
|    Compressing: C:\Python23\Lib\site-packages\inno\program\UNINST.E32
(51.9.0.0)
|    Compressing:
D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen\gridnodedsvc\dist\gridnodedsvc\gridnoded.tap
|    Compressing:
D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen\gridnodedsvc\dist\gridnodedsvc\gridnodedsvc.exe
|    Compressing:
D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen\gridnodedsvc\dist\gridnodedsvc\parser.pyd
|    Compressing:
D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen\gridnodedsvc\dist\gridnodedsvc\pyexpat.pyd
|    Compressing:
D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen\gridnodedsvc\dist\gridnodedsvc\python23.dll
|    Compressing:
D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen\gridnodedsvc\dist\gridnodedsvc\PyWinTypes23.dll
|    Compressing:
D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen\gridnodedsvc\dist\gridnodedsvc\select.pyd
|    Compressing:
D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen\gridnodedsvc\dist\gridnodedsvc\win32api.pyd
|    Compressing:
D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen\gridnodedsvc\dist\gridnodedsvc\win32process.pyd
|    Compressing:
D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen\gridnodedsvc\dist\gridnodedsvc\win32service.pyd
|    Compressing:
D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen\gridnodedsvc\dist\gridnodedsvc\_socket.pyd
|    Compressing:
D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen\gridnodedsvc\dist\gridnodedsvc\_sre.pyd
|    Compressing:
D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen\gridnodedsvc\dist\gridnodedsvc\_winreg.pyd
|
|
| Successful compile (1.402 sec). Resulting Setup program filename is:
|
D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen\gridnodedsvc\gridnoded-1.0-setup.exe
|
| Output written to
D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen\gridnodedsvc\gridnodedsvc\gridnoded-setup-1.0.exe
|
| tap2ntsvc: 0 warnings.
|
| D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen>
| D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen>
| D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen>
| D:\grid\work\python\Twisted-1.1.1\sandbox\moonfallen>
|
|
| _______________________________________________
| Twisted-Python mailing list
| Twisted-Python at twistedmatrix.com
| http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3-nr1 (Windows 2000)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAGpdn3A5SrXAiHQcRAhuSAJ9JS/gkYInzBsZN0I8+BA036pjUVQCfUV7t
p+PZrwMiupJXt2sd2xZgl8s=
=hzVT
-----END PGP SIGNATURE-----




More information about the Twisted-Python mailing list