Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Catch specific exceptions in python scripts.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 27 Oct 2017 20:12:28 +0000 (22:12 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 28 Oct 2017 07:46:28 +0000 (09:46 +0200)
tools/sg_xml_unit_converter.py
tools/tesh/tesh.py

index ff81d66..ce75e53 100644 (file)
@@ -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)
index c9cd570..1faee7f 100755 (executable)
@@ -410,7 +410,7 @@ if __name__ == '__main__':
 
     try:
         options = parser.parse_args()
-    except:
+    except SystemExit:
         tesh_exit(1)
 
     if options.cd is not None: