From 038619f97236b234f31e7e8bb2ba96bd4194509f Mon Sep 17 00:00:00 2001 From: cclauss Date: Thu, 5 Jul 2018 18:16:57 +0200 Subject: [PATCH] Catch the throw exception in variable e The next line refers to __e__ twice but it is never defined. flake8 testing of https://github.com/Aidaho12/haproxy-wi on Python 3.6.3 $ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__ ``` ./app/delver.py:58:36: F821 undefined name 'e' stderr = "Error: %s - %s." % (e.filename,e.strerror) ^ ./app/delver.py:58:47: F821 undefined name 'e' stderr = "Error: %s - %s." % (e.filename,e.strerror) ^ 2 F821 undefined name 'e' 2 ``` --- app/delver.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/delver.py b/app/delver.py index beb2fcfd..6a79ef35 100644 --- a/app/delver.py +++ b/app/delver.py @@ -54,7 +54,7 @@ if serv is not None and form.getvalue('open') is not None: os.remove(os.path.join(hap_configs_dir, form.getvalue(get))) file.add(form.getvalue(get) + "
") funct.logging(serv, "delver.py deleted config: %s" % form.getvalue(get)) - except OSError: + except OSError as e: stderr = "Error: %s - %s." % (e.filename,e.strerror) print('' % form.getvalue('serv')) @@ -72,4 +72,4 @@ output_from_parsed_template = template.render(h2 = 1, title = "Delete old versio Select = form.getvalue('del'), file = file, token = token) -print(output_from_parsed_template) \ No newline at end of file +print(output_from_parsed_template)