> def start_service(service, machine):
>     """Start a service"""
>     win32serviceutil.StartService(service, machine)
>     result = 1  #Service started successfully
>
> If I try to start a service and it is already running, I get the following
> error:
> api_error: (1056, 'StartService', 'An instance of the service is already
> running.')
>
> How would I use exception handling to catch this?

def start_service(service, machine):
    """Start a service"""
    try:
       win32serviceutil.StartService(service, machine)
       result = 1  #Service started successfully
    except win32service.error:
       result = 0

Mark.

_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython

Reply via email to