From e6fd11079b82d38745f875301c022914e0474887 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Tue, 29 Oct 2024 11:29:11 -0400 Subject: [PATCH] d.frame: Fix bare except clause (#4597) --- .flake8 | 1 - scripts/d.frame/d.frame.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.flake8 b/.flake8 index e3b2ecf8251..075fb37d075 100644 --- a/.flake8 +++ b/.flake8 @@ -99,7 +99,6 @@ per-file-ignores = scripts/v.unpack/v.unpack.py: E722, E501 scripts/v.import/v.import.py: E722, E501 scripts/db.univar/db.univar.py: E501 - scripts/d.frame/d.frame.py: E722 scripts/i.pansharpen/i.pansharpen.py: E501 scripts/v.what.strds/v.what.strds.py: E501 # Line too long (esp. module interface definitions) diff --git a/scripts/d.frame/d.frame.py b/scripts/d.frame/d.frame.py index ff77316f0ec..165dd712648 100755 --- a/scripts/d.frame/d.frame.py +++ b/scripts/d.frame/d.frame.py @@ -206,7 +206,7 @@ def calculate_frame(frame, at, width, height): """ try: b, t, l, r = list(map(float, at.split(","))) - except: + except ValueError: fatal(_("Invalid frame position: %s") % at) top = round(height - (t / 100.0 * height)) @@ -238,7 +238,7 @@ def create_frame(monitor, frame, at, overwrite=False): width = int(line.split("=", 1)[1].rsplit(" ", 1)[0]) elif "HEIGHT" in line: height = int(line.split("=", 1)[1].rsplit(" ", 1)[0]) - except: + except (ValueError, IndexError): pass if width < 0 or height < 0: