From: Arnaud Giersch Date: Fri, 27 Oct 2017 20:12:28 +0000 (+0200) Subject: Catch specific exceptions in python scripts. X-Git-Tag: v3.18~374 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3d6fc9e2b9df77c2ae9df0ff6a667f219ed5d1b0 Catch specific exceptions in python scripts. --- diff --git a/tools/sg_xml_unit_converter.py b/tools/sg_xml_unit_converter.py index ff81d66575..ce75e53d41 100644 --- a/tools/sg_xml_unit_converter.py +++ b/tools/sg_xml_unit_converter.py @@ -12,7 +12,7 @@ import sys import fnmatch import os -from decimal import Decimal +from decimal import Decimal, DecimalException import re @@ -37,7 +37,7 @@ def format(xml, formats, attrib): tmp = "%s%s" % (to_str(d), f) break res.append(tmp) - except: + except DecimalException: print "Error with:", val res.append(val) m = re.search(r'%s="(.*?)"' % attrib, xml) diff --git a/tools/tesh/tesh.py b/tools/tesh/tesh.py index c9cd570987..1faee7f4f9 100755 --- a/tools/tesh/tesh.py +++ b/tools/tesh/tesh.py @@ -410,7 +410,7 @@ if __name__ == '__main__': try: options = parser.parse_args() - except: + except SystemExit: tesh_exit(1) if options.cd is not None: