On May 13, 2016 6:38 AM, "David Hautbois" <david.hautb...@free.fr> wrote: > > Hi > > I passed all this week to get a Python Windows Service running. > But, I failed.... > > I tried Windows 2003 and Windows 2012 R2. > I installed python 3.4.4 x86 > > I installed pypiwin32 with pip : > pip install pyinstaller > > I tried many sample scripts found on Google. > I finally found sample scripts in C:\Python34\Lib\site-packages\win32\Demos\service > > I modified the servicesEvents.py script and simplified it : > ________________________________________________________________________ > import win32serviceutil, win32service > import win32event, win32api > import servicemanager > import time > > import win32gui, win32gui_struct, win32con > > class EventDemoService(win32serviceutil.ServiceFramework): > _svc_name_ = "PyServiceEventDemo" > _svc_display_name_ = "Python Service Event Demo" > _svc_description_ = "Demonstrates a Python service which takes advantage of the extra notifications" > > def __init__(self, args): > win32serviceutil.ServiceFramework.__init__(self, args) > self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) > self.running = True > > def SvcStop(self): > self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) > win32event.SetEvent(self.hWaitStop) > self.running = False > > def SvcDoRun(self): > self.ReportServiceStatus(win32service.SERVICE_RUNNING) > while self.running: > servicemanager.LogInfoMsg("aservice - is alive and well") > time.sleep(3) > > def ctrlHandler(ctrlType): > return True > > if __name__=='__main__': > win32api.SetConsoleCtrlHandler(ctrlHandler, True) > win32serviceutil.HandleCommandLine(EventDemoService) > ________________________________________________________________________ > > I get a 2186 error when starting it with cmd : net start PyServiceEventDemo > I get a 1053 error when starting it from the services manager. We need to see the exact error messages and their contexts. Post as text since this list does not take attachments. > I get these errors with this sample and others found from a Google search. > > What is the status of Python3, pywin32 and Windows services ? > Can I enabled some trace to understand the problem ? > Could someone give me a working sample ? > Could someone point me to some interesting links ? > > Thanks for your help ! > > David. > _______________________________________________ > python-win32 mailing list > python-win32@python.org > https://mail.python.org/mailman/listinfo/python-win32
_______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32