[python-win32] Installing a Python script as service

Wolfgang Schneider wschneider at ra.rockwell.com
Thu Aug 25 16:24:35 CEST 2005


Hi

We have the following problem when we try to install a Python script as 
Win32 service:

The Python script is located in a path that contains the substring 
"_demonstrator". When installing the Python service for this script, we 
get the error message, the the file "PythonService_d.exe" isn't found. We 
don't have this file in our Python installation. First investigations led 
us to the following lines at win32serviceutil.py:

def LocatePythonServiceExe(exeName = None):
    # Try and find the specified EXE somewhere.  If specifically 
registered,
    # use it.  Otherwise look down sys.path, and the global PATH 
environment.
    if exeName is None:
        if win32service.__file__.find("_d")>=0:
            exeName = "PythonService_d.exe"
        else:
            exeName = "PythonService.exe"
   ...

This function is called to find the executable for the Python service to 
store it at registry when the Python service is installed. The call to 
find("_d") returns with >0 in our case, because our path contains the 
substring "_demonstrator". I don't understand what the meaning of this 
lines is. Why is the decission for correct PythonService exe made on the 
substring "_d"? This is not very save, I think.

Can anybody explain this?

An easy workaround is to avoid the substring "_d" in the path to the 
Python script that should be installed as PythonService. But is it realy 
intended to forbid "_d" substrings in paths for PythonServices when we 
don't want to run in PythonService_d.exe? How can this be ensured in real 
world? Maybe there should be another criteria for the decision which 
PythonService exe is taken.

Regards,
Wolfgang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20050825/2620044f/attachment.htm


More information about the Python-win32 mailing list