From 68a027cf9488f37e73ee91ac3febbb957e4dbc84 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Sun, 19 Sep 2021 14:36:38 -0500 Subject: [PATCH] Draft: LGTM - don't catch BaseException --- src/Mod/Draft/draftgeoutils/general.py | 2 +- src/Mod/Draft/draftguitools/gui_setstyle.py | 4 ++-- src/Mod/Draft/draftobjects/patharray.py | 2 +- src/Mod/Draft/draftutils/units.py | 2 +- src/Mod/Draft/importDWG.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Mod/Draft/draftgeoutils/general.py b/src/Mod/Draft/draftgeoutils/general.py index ba45625906..e89c5f0daa 100644 --- a/src/Mod/Draft/draftgeoutils/general.py +++ b/src/Mod/Draft/draftgeoutils/general.py @@ -258,7 +258,7 @@ def geomType(edge): return "Ellipse" else: return "Unknown" - except: # catch all errors, no only TypeError + except Exception: # catch all errors, no only TypeError return "Unknown" diff --git a/src/Mod/Draft/draftguitools/gui_setstyle.py b/src/Mod/Draft/draftguitools/gui_setstyle.py index d502dd7a06..1d3046ea99 100644 --- a/src/Mod/Draft/draftguitools/gui_setstyle.py +++ b/src/Mod/Draft/draftguitools/gui_setstyle.py @@ -297,7 +297,7 @@ class Draft_SetStyle_TaskPanel: try: import json from json.decoder import JSONDecodeError - except: + except Exception: return if os.path.exists(PRESETPATH): with open(PRESETPATH,"r") as f: @@ -313,7 +313,7 @@ class Draft_SetStyle_TaskPanel: try: import json - except: + except Exception: FreeCAD.Console.PrintError(translate("Draft","Error: json module not found. Unable to save style")+"\n") return folder = os.path.dirname(PRESETPATH) diff --git a/src/Mod/Draft/draftobjects/patharray.py b/src/Mod/Draft/draftobjects/patharray.py index 264964e775..82284df5b4 100644 --- a/src/Mod/Draft/draftobjects/patharray.py +++ b/src/Mod/Draft/draftobjects/patharray.py @@ -521,7 +521,7 @@ def calculate_placement(globalRotation, try: t = edge.tangentAt(get_parameter_from_v0(edge, offset)) t.normalize() - except: + except Exception: _wrn(translate("draft","Cannot calculate path tangent. Copy not aligned.")) return placement diff --git a/src/Mod/Draft/draftutils/units.py b/src/Mod/Draft/draftutils/units.py index df5bb657da..2966716d19 100644 --- a/src/Mod/Draft/draftutils/units.py +++ b/src/Mod/Draft/draftutils/units.py @@ -107,7 +107,7 @@ def display_external(internal_value, uom = unit internal_value = q.getValueAs(unit) conversion = 1 - except: + except Exception: conversion = q.getUserPreferred()[1] uom = q.getUserPreferred()[2] elif dim == 'Angle': diff --git a/src/Mod/Draft/importDWG.py b/src/Mod/Draft/importDWG.py index 29fc05d4c8..8c9dd1c19d 100644 --- a/src/Mod/Draft/importDWG.py +++ b/src/Mod/Draft/importDWG.py @@ -210,7 +210,7 @@ def convertToDxf(dwgfilename): proc = subprocess.Popen(("dwg2dxf", dwgfilename, "-o", result)) proc.communicate() return result - except: + except Exception: pass teigha = getTeighaConverter()