How do you run a Python script as a service in Windows?

后端 未结 13 1635
你的背包
你的背包 2020-11-22 02:18

I am sketching the architecture for a set of programs that share various interrelated objects stored in a database. I want one of the programs to act as a service which prov

13条回答
  •  遇见更好的自我
    2020-11-22 02:54

    I started hosting as a service with pywin32.

    Everything was well but I met the problem that service was not able to start within 30 seconds (default timeout for Windows) on system startup. It was critical for me because Windows startup took place simultaneous on several virtual machines hosted on one physical machine, and IO load was huge. Error messages were:

    Error 1053: The service did not respond to the start or control request in a timely fashion.

    Error 7009: Timeout (30000 milliseconds) waiting for the service to connect.

    I fought a lot with pywin, but ended up with using NSSM as it was proposed in this answer. It was very easy to migrate to it.

提交回复
热议问题