因此,我设法将python脚本转换为Windows服务,并且还勾选了允许其与本地桌面进行交互的选项。但仍在运行该服务时,我看不到弹出任何浏览器。该服务虽然在后台运行良好,但日志已记录在文件中。我确实需要显示我的应用程序需求。任何想法或任何变通办法吗? 谢谢 !任何帮助表示赞赏。
这是我的代码供参考:
class AutomatoSvc(win32serviceutil.ServiceFramework):
_svc_name_ = "Automato-Job-Service"
_svc_display_name_ = "Automato Whatsapp Service"
def __init__(self,args):
win32serviceutil.ServiceFramework.__init__(self,args)
self.stop_event = win32event.CreateEvent(None,0,0,None)
socket.setdefaulttimeout(60)
self.stop_requested = False
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
win32event.SetEvent(self.stop_event)
logging.info('Stopping service ...')
stop_consume()
self.stop_requested = True
def SvcDoRun(self):
servicemanager.LogMsg(
servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STARTED,
(self._svc_name_,'')
)
self.main()
def main(self):
logging.info(' ** Starting Whatsapp Job service ** ')
# Simulate a main loop
run_consume()
if __name__ == '__main__':
win32serviceutil.HandleCommandLine(AutomatoSvc)