None Type Fix

* fix self.process None Type operation error
This commit is contained in:
nico 2019-03-04 01:17:02 +01:00
parent 85ca549fab
commit 347d2f5d46
Signed by: mightyBroccoli
GPG Key ID: EA7C31AAB1BDC1A2
1 changed files with 9 additions and 4 deletions

View File

@ -70,11 +70,16 @@ class BlacklistImporter:
def process(self): def process(self):
# init new YAML variable # init new YAML variable
local_file = YAML(typ="safe") local_file = YAML(typ="safe")
# prevent None errors
if self.outfile is not None:
# catch FileNotFoundError on first run or file missing
try: try:
local_file = local_file.load(open(self.outfile, "r", encoding="utf-8")) local_file = local_file.load(open(self.outfile, "r", encoding="utf-8"))
except FileNotFoundError: except FileNotFoundError:
pass pass
remote_file = { remote_file = {
"acl": { "acl": {
"spamblacklist": { "spamblacklist": {