[python-win32] FW: Python script as a windows service

Tor Erik Sønvisen torerik81 at gmail.com
Thu Nov 2 10:27:43 CET 2006


Hi,
 
I'm trying to execute a python script as a windows service.
I found some information at:
http://agiletesting.blogspot.com/2005/09/running-python-script-as-windows.ht
ml
 
The steps I've taken are the following:
 
1. Downloaded Windows Resource Kits
2. Executed instsrv.exe nameOfService srvany.exe
3. In registry added a key Parameters in
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\nameOfService entry
4. Under Parameters added three string values:
    4.1: Application                REG_SZ
C:\Python25\pythonw.exe
    4.2: AppDirectory            REG_SZ                    C:\Python25
    4.3: AppParameters         REG_SZ                    C:\Documents and
Settings\torerik\My Documents\Apps\SARImageProcessing\time.py
5. Started nameOfService in Control Panel --> Adminstrative Tools -->
Services
 
This is not working however as the python script (time.py) looks like this:
 
import time
 
i = 0
while True:
    f = open(r'C:\testService.txt', 'wb')
    f.write(str(i))
    f.close()
    i += 1
    time.sleep(1)
 
and no file named testService.txt is created.
I've tried executing the script normally, and it works like a charm...
Any ideas?
 
regards
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20061102/dcda95d7/attachment.html 


More information about the Python-win32 mailing list