win32service methods produces the same problem: def Enable(self, serviceName, enable, autoStart=False): startType = None if not enable: startType = win32service.SERVICE_DISABLED elif autoStart: startType = win32service.SERVICE_AUTO_START else: startType = win32service.SERVICE_DEMAND_START
scm = win32service.OpenSCManager(None, None, win32service.SC_MANAGER_ALL_ACCESS) svc = win32service.OpenService(scm, serviceName, win32service.SC_MANAGER_ALL_ACCESS) win32service.ChangeServiceConfig(svc, win32service.SERVICE_NO_CHANGE, startType, win32service.SERVICE_NO_CHANGE, None, None, 0, None, None, None, None) win32service.CloseServiceHandle(svc) On 8/31/07, Tim Roberts <[EMAIL PROTECTED]> wrote: > > Dmitry Alekseenko wrote: > > Hey guys, > > > > I've written the following function to enable/disable windows services: > > > > def Enable(self, serviceName, enable, autoStart=False): > > startType = None > > if not enable: > > startType = win32service.SERVICE_DISABLED > > elif autoStart: > > startType = win32service.SERVICE_AUTO_START > > else: > > startType = win32service.SERVICE_DEMAND_START > > win32serviceutil.ChangeServiceConfig(None, serviceName, startType) > > > > And it turns out that when I call Enable('W32Time', False) it corrupts > > the "path to executable" property of the service. It replaces the path > > to "C:\Python24\lib\site-packages\win32\PythonService.exe". > > > > What wrong am I doing? > > win32serviceutil.ChangeServiceConfig is a wrapper around the service > management APIs, designed specifically for managing Python services. > When you omit the exeName parameter, it assumes you want the generic > Python service wrapper, and looks up the name. > > I suggest you skip the win32serviceutil wrapper altogether and call > win32service.ChangeServiceConfig. That is a much more direct wrapper > around the Win32 API. You will have to open the service manager > yourself, but you can look at the source for win32serviceutil.py to see > how to do that. > > -- > Tim Roberts, [EMAIL PROTECTED] > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 >
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32