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

Cory Dodt corydodt at twistedmatrix.com
Wed Jan 28 11:11:36 EST 2004

Hash: SHA1

Thanks for trying it out.

Can you provide more details on how you ran tap2ntsvc from the command line?
The exact command line, environment (especially PYTHONPATH), working
directory, what shell (whether cygwin or windows)...

I am able to run it by ...

Start > Run... > "cmd"
C:\winnt\system32>cd %twisted%\sandbox\moonfallen
C:\...\Twisted-HEAD\sandbox\moonfallen>python tap2ntsvc --help
<<< output here >>>


Schneider, Michael wrote:

| I am tring to convert a twisted .tap file (gridnoded.tap) to a service
| for windows 2000 and XP.
| I installed the required python packages:
|         - inno
|         - win32 extensions
| What I have done:
|     created .tap file
|     run with twistd  (checks out ok)
| When I run tap2ntsvc --help,  I get no output (error or help message).
| what else do I have to do to get this going?
| Thanks for your efforts with tap2ntsvc,
| Mike
| ------------------------------------------------------------------------------
| I've finished the initial work on tap2ntsvc.  This script does the
| tedious work of creating an installer around your Twisted service.  A
| quick howto:
| 1. Create a tap or tac file for your application, using the method you
| normally use.  **Test with twistd to make sure that you can start the
| app from the command line, _before_ you wrap a service around it.**
| 2. Acquire and install the prerequisites of tap2ntsvc.  It depends on
| software outside of Twisted, specifically:
| win32all @ http://starship.python.net/crew/mhammond/win32/Downloads.html
| Innoconda @ http://twistedmatrix.com/~moonfallen/innoconda.html
| 3. Run tap2ntsvc from the command line.  (*This is not yet integrated
| with the "Twisted Command Prompt" available on MSWindows with the
| official Twisted installer, but it will be when the script becomes an
| official part of Twisted.) Use --help to get the command line options.
| To start with, all you need to provide is the name of your tap or tac file.
| |/ python .../Twisted/sandbox/moonfallen/tap2ntsvc myapp.tac
| /This will build an installable package using Innoconda.
| 4. Install the package.  It will be in myappsvc/myapp-...-setup.exe.
| 5. Start the service; it will fail, but you'll find out what modules you
| need to add.
| |/ net start myapp
| /**It's ok if this doesn't work.**
| 6. Check the Application event log to find out what modules failed to
| import; you will be re-running py2exe after you add the missing modules.
| 7. Either: (a) re-run tap2ntsvc with the -i option or (b) add your
| modules to myappsvc/setup.cfg on the "includes=" line.  If you choose to
| do the latter, read myappsvc/README.txt to find out how to recompile
| just the parts you need.
| 8. Redo steps 3 through 7 until you no longer get ImportErrors in the
| Application log.
| 9. Some applications need data files.  If you need data files in your
| application, consult myappsvc/README.txt and edit myappsvc/myapp.fms.
| myapp.fms uses a special command language to make adding data files as
| intuitive as possible.  You can put files in c:\Program Files\myapp or
| any subdirectory thereof, so make sure your application code can find
| data files there.
| When you're done, you should be able to 'net start myapp' successfully.
| ~   When you want to rebuild it in the future, just keep these files in
| your version control:
| ~  myappsvc/do_inno_script.py
| ~           do_inno.py
| ~           setup.cfg
| ~           setup.py
| ~           myapp.fms
| Caveats, bugs, TODO:
| - - you must be able to start your application in py2exe.  Things most
| likely to not work are finding important data files based on the value
| of __file__ in some module.
| - - if you install the same service multiple times without uninstalling it
| in between installs, then start it, then uninstall it, it will crash on
| uninstall.  Just be sure to uninstall it in between installs while
| you're experimenting.
| - - I want to make the module finder more foolproof, saving several of the
| steps above.  This is a non-trivial problem, however.
| - - Really, it needs a frontend.  And I hate Tk.  Can I put a Gtk app into
| ~ Twisted proper? :-)
| The future:
| I want to move tap2ntsvc out of sandbox and into main Twisted.  I want
| people to read this email over and try it before I do so, in case there
| are important concerns I need to address.  We need to give some thought
| to what to do about the 2 significant dependencies.  Should this block
| tap2ntsvc from being in Twisted proper?  Is there a policy for this sort
| of thing?
| ----------------------------------------------------------------
| 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"

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


More information about the Twisted-Python mailing list