[Python-bugs-list] win32service.OpenService does not handle embeded spaces. (PR#126)

m.boorman@ieee.org m.boorman@ieee.org
Tue, 9 Nov 1999 20:10:04 -0500 (EST)


Full_Name: Mathew Boorman
Version: 1.5.2
OS: NT 4.0
Submission from: pan.admiral.co.uk (193.112.216.1)


win32service.OpenService does not handle embeded spaces in the service name, it
does not find the name. The following code sample works OK for the first names,
but any Service Names with embedded spaces fail, with a message as follows.

Note that this occurs with both Win32all v125 and 127(beta3). (The output
supplied is using 127)
Starting the service from the NT command line works fine with command:
net start "Protected Storage"
   
MSDTC
MSSQLServer
Protected Storage
Traceback (innermost last):
  File "d:\Program Files\Python\Pythonwin\pywin\framework\scriptutils.py", line
313, in RunScript
    exec codeObject in __main__.__dict__
  File "D:\Projects\python\startService.py", line 34, in ?
    win32serviceutil.RestartService(b)
  File "d:\Program Files\Python\win32\lib\win32serviceutil.py", line 319, in
RestartService
    raise win32service.error, (hr, name, msg)
api_error: (1060, 'OpenService', 'The specified service does not exist as an
installed service.')

Code fragment:
import win32serviceutil, pywintypes
import win32service, win32api, win32con, winerror
a = [
   "MSDTC",
   "MSSQLServer",
   "Protected Storage",
   "World Wide Web Publishing Service",
   "FTP Publishing Service"]
for x in a:
    print x
    win32serviceutil.RestartService(x)