diff --git a/.flake8 b/.flake8 index 32021622d7d..5d3f2fca5d0 100644 --- a/.flake8 +++ b/.flake8 @@ -20,7 +20,6 @@ per-file-ignores = # F841 local variable assigned to but never used # E741 ambiguous variable name 'l' __init__.py: F401, F403 - lib/init/grass.py: E722, F821, F841 man/build_check_rest.py: F403, F405 man/build_full_index_rest.py: F403, F405 man/parser_standard_options.py: F403, F405 diff --git a/lib/init/grass.py b/lib/init/grass.py index 82c1ee4a812..5a62e65ac53 100755 --- a/lib/init/grass.py +++ b/lib/init/grass.py @@ -484,7 +484,7 @@ def create_gisrc(tmpdir, gisrcrc): if "UNKNOWN" in s: try_remove(gisrcrc) s = None - except: + except Exception: s = None # Copy the global grassrc file to the session grassrc file @@ -1162,7 +1162,7 @@ def set_language(grass_config_dir): encoding = "UTF-8" normalized = locale.normalize("%s.%s" % (language, encoding)) locale.setlocale(locale.LC_ALL, normalized) - except locale.Error as e: + except locale.Error: if language == "en": # A workaround for Python Issue30755 # https://bugs.python.org/issue30755 @@ -1188,7 +1188,7 @@ def set_language(grass_config_dir): # See bugs #3441 and #3423 try: locale.setlocale(locale.LC_ALL, "C.UTF-8") - except locale.Error as e: + except locale.Error: # All lost. Setting to C as much as possible. # We can not call locale.normalize on C as it # will transform it to en_US and we already know @@ -1571,7 +1571,7 @@ def say_hello(): revision = linerev.split(" ")[1] sys.stderr.write(" (" + revision + ")") - except: + except Exception: pass @@ -1937,7 +1937,7 @@ def print_params(params): try: revision = linerev.split(" ")[1] sys.stdout.write("%s\n" % revision[1:]) - except: + except Exception: sys.stdout.write("No SVN revision defined\n") elif arg == "version": sys.stdout.write("%s\n" % GRASS_VERSION)