aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornico <nico@magicbroccoli.de>2019-03-04 01:17:02 +0100
committernico <nico@magicbroccoli.de>2019-03-04 01:17:02 +0100
commit347d2f5d46a4100804e23f5440a3904e5acdc528 (patch)
treec94bbbf45963192a1b81d5360eb81ec8a1bef635
parent85ca549fabf298dd87ae34b4779604bad8efbe5b (diff)
None Type Fix
* fix self.process None Type operation error
-rw-r--r--main.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/main.py b/main.py
index c9deb83..9fef752 100644
--- a/main.py
+++ b/main.py
@@ -70,10 +70,15 @@ class BlacklistImporter:
def process(self):
# init new YAML variable
local_file = YAML(typ="safe")
- try:
- local_file = local_file.load(open(self.outfile, "r", encoding="utf-8"))
- except FileNotFoundError:
- pass
+
+ # prevent None errors
+ if self.outfile is not None:
+ # catch FileNotFoundError on first run or file missing
+ try:
+ local_file = local_file.load(open(self.outfile, "r", encoding="utf-8"))
+ except FileNotFoundError:
+ pass
+
remote_file = {
"acl": {