fix: UnboundLocalError due to reference before assignment

* fix broken none catch
This commit is contained in:
nico 2021-07-23 18:00:53 +02:00
parent b2b44ce4c1
commit a0ac0b2cea
Signed by: mightyBroccoli
GPG Key ID: 1F6495B44DABCE6E
1 changed files with 4 additions and 5 deletions

View File

@ -10,20 +10,19 @@ class ProcessBlocklist:
def __init__(self):
pass
@classmethod
def process(self, blacklist, outfile, dryrun: bool):
"""
function to build and compare the local yaml file to the remote file
if the remote file is different, the local file gets overwritten
"""
# cheeky none catch
try:
# load local blacklist outfile
if local_file_present(outfile):
with open(outfile, "r", encoding="utf-8") as local_file:
local_blacklist = local_file.read()
except TypeError:
except (TypeError, FileNotFoundError):
# no local copy use empty one instead
local_blacklist = YAML(typ="safe")