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
The accepted answer using win32serviceutil works but is complicated and makes debugging and changes harder. It is far easier to use NSSM (the Non-Sucking Service Manager). You write and comfortably debug a normal python program and when it finally works you use NSSM to install it as a service in less than a minute:
From an elevated (admin) command prompt you run nssm.exe install NameOfYourService and you fill-in these options:
C:\Python27\Python.exe)c:\path\to\program.py)By the way, if your program prints useful messages that you want to keep in a log file NSSM can also handle this and a lot more for you.