Creating and Installing Python NT Services
Mark Hammond
mhammond at skippinet.com.au
Thu Feb 27 01:47:25 EST 2003
kay c wrote:
> Hi,
> I have a couple questions regarding Python and NT Services.
>
> I zipped up the python directory from a machine that has python
> installed using the wise install, default install. I unzipped so the
> python directory so it looks exactly like the one it came from. I
> placed all the python dll's in the path and tried to register
> PythonService.exe, this failed.
> QUESTION 1: Is this impossible. I am attempting to do this because
> wise does not offer a solution of a silent install to a specified
> directory.
It is possible, but will probably require the Python related registry
entries to be setup. See your HKLM\Software\Python subtree.
> I created a simple Python NT Service using examples I found from
> postings for this group.
> I register the PythonService.exe and then install the service ( On
> machine that has installed python using wise install).
> The Service simply calls a python exe that is located on the local
> machine. I can successfully install this Service on windows 2000
> professional but when I use the install option against my service
> script on windows 2000 Server it doesn't install; it opens the .py
> script in notepad with no errors in the cmd shell.
>
>>jini_service.py install
>
> QUESTION 2. Any idea what could be happening?
The server machine has .py files associated with notepad. Try using
"python jini_service.py install"
> I successfully install the NT Service on my 2000 profession machine
> and start it through the start command, the executable executes as
> expected,
>
>>jini_service.py start
>
> however if I look at the Services GUI found in Settings\Control
> Panel\Administrative tools the Service status is blank. The Event
> Viewer information log reports the status as started.
> When I stop the service it tells me the service isn't start; Error
> stopping service: The service has not been started. (1062), however I
> know my executable use executed.
> QUESTION 3. Any idea what I am missing?
You service does not have a loop! It executes once, then terminates.
Most services have their SvcDoRun() function in a loop, waiting for the
event that tells them to shut down. Indeed, that is the point of a
service - to keep running.
Mark.
More information about the Python-list
mailing list