From ebde2fcba2ec3654aeb774eddef569d7e2293814 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 1 Apr 2015 17:41:40 +0200 Subject: [PATCH] create dest_dir if needed fixes #48 --- backend.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend.py b/backend.py index e5c5206..57707bf 100755 --- a/backend.py +++ b/backend.py @@ -19,6 +19,8 @@ from lib.rrddb import RRD def main(params): + os.makedirs(params['dest_dir'], exist_ok=True) + nodes_fn = os.path.join(params['dest_dir'], 'nodes.json') graph_fn = os.path.join(params['dest_dir'], 'graph.json') @@ -52,7 +54,7 @@ def main(params): try: with open(nodes_fn, 'r') as nodedb_handle: nodedb = json.load(nodedb_handle) - except FileNotFoundError: + except IOError: nodedb = {'nodes': dict()} # flush nodedb if it uses the old format