Python Windows service pyinstaller executables error 1053

后端 未结 2 1918
再見小時候
再見小時候 2020-12-13 07:25

I have written a Windows service in python. If I run my script from the command prompt

python runService.py 

When I do this the service ins

2条回答
  •  鱼传尺愫
    2020-12-13 07:53

    Try changing the last few lines to

    if __name__ == '__main__':
        if len(sys.argv) == 1:
            servicemanager.Initialize()
            servicemanager.PrepareToHostSingle(Service)
            servicemanager.StartServiceCtrlDispatcher()
        else:
            win32serviceutil.HandleCommandLine(Service)
    

提交回复
热议问题