On 3/03/2022 4:21 pm, Siyuan Ren wrote:
I'm trying to subclass win32serviceutil.ServiceFramework in order to create a Windows service in Python. I vaguely understand how each stage of service works, but I wonder, what happens if any of the python code throws an exception? Will the service stop, or put in an abnormal state without recourse?

In general it will log a message to the eventlog and stop. Up until https://github.com/mhammond/pywin32/issues/1563 & https://github.com/mhammond/pywin32/pull/1566, it ended up reporting a normal `SERVICE_STOPPED` with an exit code of zero, but now it reports a non-zero code so you can configure it to auto-restart on exceptions.

HTH,

Mark
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to