Let's say I have a Service that I've written that's based on win32serviceutil.ServiceFramework
like so:
class Launcher(win32serviceutil.ServiceFramework):
_svc_name_ = "QueueFolders"
_svc_display_name_ = "Queue Hot Folders"
def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(self, args)
self.hWaitStop = win32event.CreateEvent(None, 0, 0, None)
def SvcStop(self):
sys.stopservice = True
def SvcDoRun(self):
# A call to something Main() like here.
QueueFolders()
In this example calling QueueFolders
instantiates an object that should be long-running if proper configuration has been done. If not, it raises an exception and I get this in my command prompt:
j:\EclipseWorkspace\Queue Folders\dist>net start queuefolders
The Queue Hot Folders service is starting.
The Queue Hot Folders service could not be started.
The service did not report an error.
More help is available by typing NET HELPMSG 3534.
I'm wondering, how would I report this error? I know I can try / catch
my instantiation, but I've tried self.ReportServiceStatus(win32service.SERVICE_ERROR_CRITICAL)
and still don't seem to be able to report anything meaningful back to the user (ideally, something in the form of "The service could not start, please check configuration."