making a Windows NT service out of a python program

Mark Hammond MHammond at skippinet.com.au
Tue Jul 13 19:06:10 EDT 1999


Andrew Cooke wrote in message <7mfot5$n30$1 at nnrp1.deja.com>...
>In article <378B2C50.B7C2134A at cern.ch>,
>  "Haimo G. Zobernig" <Haimo.Zobernig at cern.ch> wrote:


>They are useful because you can specify an account for them to run in
>(assuming you have sufficient priveliges), set whether they should be
>started automatically, and let them access the user's screen.

Actually, "let them access the user's screen" is not technically correct.
The term they use is "desktop", and for good reason.  The desktop the
service has access to may _not_ be the user's desktop!!  If anyone is
interested, I can point to you a magazine with a very good series on NT
Services and how they interact with NT.

>to stop, start, pause them etc.)  Writing programs to install/start
>services is more complicated, but hopefully you won't need to do that
>(the Control panel can stop and start them, and I assume the Python
>package others mentioned has an installer).  If you poke around in the

Indeed it does.  Installing a Python service is trivial.  The Python
interface also allows you to specify the account, desktop interaction
options, startup options, etc, just as you would expect (also as you would
expect of Python, this is command-line only :-)  Then again, Python _can_
display the standard NT services dialog!

>The worst thing about them is that they can be tricky to debug.  If they
>are running in the system account then they have a restricted
>environment and the standard output channels send useful data to

he he - not with Python :-)  Just import win32traceutil at the top of your
service, and you can see all your print statements in Pythonwin :-)

>All this is from C and Java knowledge, I've never written a Python
>service, so I can't give more specific help.

You should spend an hour having a play - hopefully you will be impressed :-)
Ive never played with Java's services, but Python is light-years ahead of
C/C++ in terms of ease in creating services.

Mark.






More information about the Python-list mailing list