making a Windows NT service out of a python program

Haimo G. Zobernig Haimo.Zobernig at cern.ch
Wed Jul 14 11:21:53 EDT 1999


Bill Tutt wrote:
> 
> Take a look at the stuff in win32\demos\service\ of your friendly latest
> Win32 extension install tree.
> 
> It shows you how to wrap Python code into an NT service quite easily.
> 
> The code in win32\lib\win32serivceutil.py appears to do almost everything
> you would ever want to do with a service. Very cool stuff...
> 
> No, I didn't write it, it's all Mark's fault... :)
> 
> Bill

Hi,
I have been trying the pipeTestService.py in win32\demos\service, sending it
single messages with the pipeTestServiceClient.py script - that works fine.
But I get errors when trying out the multi-thread multi-message options
( -t <n> -m <k> ). I am running the script with ^R from within PythonWin.

pipeTestServiceClient.py -v 'test test test'

>>> Sending 'test test test'
Server sent back 'haimo (on thread 172) sent me 'test test test''


pipeTestServiceClient.py -t 10 -m 20 -v 'test test test'

>>> Sending 'test test test'
Server sent back 'haimo (on thread 132) sent me 'test test test''
Spawning 10 threads each sending 20 messages...
Traceback (innermost last):
  File "C:\Program Files\Python\win32\demos\service\pipeTestServiceClient.py",
line 68, in stressThread
    r = CallPipe(CallNamedPipe, ("\\\\%s\\pipe\\PyPipeTest" % server, "#" * 512,
1024, NMPWAIT_WAIT_FOREVER))
  File "C:\Program Files\Python\win32\demos\service\pipeTestServiceClient.py",
line 45, in CallPipe
    raise win32api.error, (rc, fnerr, msg)
api_error: (233, 'CallNamedPipe', 'No process is on the other end of the pipe.')
Failed after 0 messages
Traceback (innermost last):
  File "C:\Program Files\Python\win32\demos\service\pipeTestServiceClient.py",
line 68, in stressThread
    r = CallPipe(CallNamedPipe, ("\\\\%s\\pipe\\PyPipeTest" % server, "#" * 512,
1024, NMPWAIT_WAIT_FOREVER))
  File "C:\Program Files\Python\win32\demos\service\pipeTestServiceClient.py",
line 45, in CallPipe
    raise win32api.error, (rc, fnerr, msg)
api_error: (233, 'CallNamedPipe', 'No process is on the other end of the pipe.')
Failed after 2 messages
Traceback (innermost last):
  File "C:\Program Files\Python\win32\demos\service\pipeTestServiceClient.py",
line 68, in stressThread
    r = CallPipe(CallNamedPipe, ("\\\\%s\\pipe\\PyPipeTest" % server, "#" * 512,
1024, NMPWAIT_WAIT_FOREVER))
  File "C:\Program Files\Python\win32\demos\service\pipeTestServiceClient.py",
line 45, in CallPipe
    raise win32api.error, (rc, fnerr, msg)
api_error: (233, 'CallNamedPipe', 'No process is on the other end of the pipe.')
Failed after 4 messages

etc...

Am I doing something wrong, or does that really not work?
I'd like to be sure that the examples work before I adapt them to my own
programs.

-- 
Haimo G. Zobernig                                  tel   +41 22 7677361
Univ. of Wisconsin                                 fax   +41 22 7678370
c/o CERN Bld. 32 R-A02
1211 Geneve 23, Switzerland                email Haimo.Zobernig at cern.ch




More information about the Python-list mailing list