aboutsummaryrefslogtreecommitdiff
path: root/anarchronofile
diff options
context:
space:
mode:
Diffstat (limited to 'anarchronofile')
-rwxr-xr-xanarchronofile14
1 files changed, 9 insertions, 5 deletions
diff --git a/anarchronofile b/anarchronofile
index a21aa08..26ee7e5 100755
--- a/anarchronofile
+++ b/anarchronofile
@@ -24,16 +24,20 @@ import yaml
import argparse
from pprint import pprint
-class Anarchronofile:
+class AnarChronofile:
def __init__(self, args):
if not os.path.exists(args.file[0]):
raise FileNotFoundError('File not found: ' + args.file[0])
- self.args = args
- self.file = open(args.file[0], '+r')
- self.yaml = yaml.load(self.file)
+ if os.path.isfile(args.file[0]):
+ self.args = args
+ self.file = open(args.file[0], '+r')
+ self.yaml = yaml.load(self.file)
def run(self):
+ if getattr(self, 'args', None) is None:
+ return
+
print(self.args)
print("---")
print("")
@@ -88,7 +92,7 @@ if __name__ == "__main__":
args = cmdline()
try:
- parser = Anarchronofile(args)
+ parser = AnarChronofile(args)
parser.run()
except (FileNotFoundError, KeyboardInterrupt) as e:
print(e)