From 783f1ad2024e4d4d63259221bdf11b364d877379 Mon Sep 17 00:00:00 2001 From: joamag Date: Mon, 18 Apr 2016 19:56:02 +0100 Subject: [PATCH] better support --- src/story/scripts/creator.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/story/scripts/creator.py b/src/story/scripts/creator.py index 78c3a1b..e9018ed 100644 --- a/src/story/scripts/creator.py +++ b/src/story/scripts/creator.py @@ -37,6 +37,9 @@ __license__ = "Apache License, Version 2.0" """ The license for the module """ +import os +import pprint + import appier import story @@ -46,13 +49,13 @@ def create(*args, **kwargs): if __name__ == "__main__": name = appier.conf("NAME", "untitled") - path = appier.conf("PATH", None) + file_path = appier.conf("FILE_PATH", None) - if not path: - raise appier.OperationalError(message = "No path defined") + if not file_path or not os.path.exists(file_path): + raise appier.OperationalError(message = "No path defined or path invalid") - file = open(path, "rb") + file = open(file_path, "rb") kwargs = dict(name = name, file = file) result = create(**kwargs) - print(result) + pprint.pprint(result)