Catching all exceptions in a try-except block is almost always a bad idea. You can't tell the difference between an exception that you are looking to handle and an exception that should cause your program to crash and burn (because something is wrong). It's best to catch a specific exception. What condition are you looking to handle here?
-Jorge On Sat, Oct 7, 2017 at 9:38 AM, Prabu T.S. <prabu...@gmail.com> wrote: > 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') > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list