diff --git a/.flake8 b/.flake8 index 1052000179b..48ec278ee63 100644 --- a/.flake8 +++ b/.flake8 @@ -42,7 +42,6 @@ per-file-ignores = # TODO: Is this really needed? python/grass/jupyter/__init__.py: E501 python/grass/pygrass/vector/__init__.py: E402 - python/grass/temporal/datetime_math.py: E722 python/grass/temporal/spatial_topology_dataset_connector.py: E722 python/grass/temporal/temporal_algebra.py: E722 python/grass/temporal/temporal_granularity.py: E722 diff --git a/python/grass/temporal/datetime_math.py b/python/grass/temporal/datetime_math.py index b96cd8c3e2a..a40be0aea16 100644 --- a/python/grass/temporal/datetime_math.py +++ b/python/grass/temporal/datetime_math.py @@ -21,7 +21,7 @@ from dateutil import parser has_dateutil = True -except: +except (ImportError, ModuleNotFoundError): has_dateutil = False @@ -811,7 +811,7 @@ def check_datetime_string(time_string: str, use_dateutil: bool = True): try: return datetime.strptime(time_string, time_format) - except: + except (ValueError, TypeError): return _("Unable to parse time string: %s") % time_string