exception should not stop program.
Prabu T.S.
prabu.ts at gmail.com
Sat Oct 7 12:38:00 EDT 2017
I would like to continue to second function invocation "checkServiceStatus('AdobeARMservice')" even if the first
checkServiceStatus('Tomcat9') has any exception.Please advice.Second function invocation not getting executed if any exception occurs in first.Please advice.
import psutil
def checkServiceStatus(server):
status = None
try:
service = psutil.win_service_get(server)
status = service.as_dict()
print("%s (%s)" % (status['name'], status['display_name']))
print("status: %s, start: %s, username: %s, pid: %s" % (
status['status'], status['start_type'], status['username'], status['pid']))
print("binpath: %s" % status['binpath'])
print(" ")
except Exception:
pass
return status
checkServiceStatus('Tomcat9')
checkServiceStatus('AdobeARMservice')
More information about the Python-list
mailing list