Here is an example code showing the problem:
import win32serviceutil
import win32service
import win32event
import win32api
import servicemanager
import sys
class AppServerSvc (win32serviceutil.ServiceFramework):
_svc_name_ = "TestService"
_svc_display_name_ = "Test Service"
def __init__(self,args):
win32serviceutil.ServiceFramework.__init__(self,args)
self.hWaitStop = win32event.CreateEvent(None,0,0,None)
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
win32event.SetEvent(self.hWaitStop)
def SvcDoRun(self):
servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STARTED,
(self._svc_name_,''))
while True :
if getattr(sys, "stopservice", False) :
#sys.exit()
break
with open("test.txt", 'a') as f :
f.write("Test string\n")
win32api.SleepEx(3000, True)
if __name__ == '__main__':
win32serviceutil.HandleCommandLine(AppServerSvc)
--
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyinstaller?hl=en.