aboutsummaryrefslogtreecommitdiff
path: root/bh20simplewebuploader/main.py
diff options
context:
space:
mode:
authorPjotr Prins2020-07-15 12:48:12 +0100
committerPjotr Prins2020-07-15 14:17:27 +0100
commit9c9512a7e040f8247d259bdc6f9cf55d5d276baf (patch)
treedd221d06612568992e16f1debaeea418c22b61e7 /bh20simplewebuploader/main.py
parentf44d555b788e29a1896a69d75401f0e145ad9299 (diff)
downloadbh20-seq-resource-9c9512a7e040f8247d259bdc6f9cf55d5d276baf.tar.gz
bh20-seq-resource-9c9512a7e040f8247d259bdc6f9cf55d5d276baf.tar.lz
bh20-seq-resource-9c9512a7e040f8247d259bdc6f9cf55d5d276baf.zip
Load metadata locally without pkg_resources
Diffstat (limited to 'bh20simplewebuploader/main.py')
-rw-r--r--bh20simplewebuploader/main.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py
index 77e345b..8b5781a 100644
--- a/bh20simplewebuploader/main.py
+++ b/bh20simplewebuploader/main.py
@@ -227,8 +227,13 @@ def generate_form(schema, options):
# At startup, we need to load the metadata schema from the uploader module, so we can make a form for it
-METADATA_SCHEMA = yaml.safe_load(pkg_resources.resource_stream("bh20sequploader", "bh20seq-schema.yml"))
-METADATA_OPTION_DEFINITIONS = yaml.safe_load(pkg_resources.resource_stream("bh20sequploader", "bh20seq-options.yml"))
+if os.path.isfile("bh20sequploader/bh20seq-schema.yml"):
+ METADATA_SCHEMA = yaml.safe_load(open("bh20sequploader/bh20seq-schema.yml","r").read())
+ METADATA_OPTION_DEFINITIONS = yaml.safe_load(open("bh20sequploader/bh20seq-options.yml","r").read())
+else:
+ METADATA_SCHEMA = yaml.safe_load(pkg_resources.resource_stream("bh20sequploader", "bh20seq-schema.yml"))
+ METADATA_OPTION_DEFINITIONS = yaml.safe_load(pkg_resources.resource_stream("bh20sequploader", "bh20seq-options.yml"))
+print(METADATA_SCHEMA,file=sys.stderr)
FORM_ITEMS = generate_form(METADATA_SCHEMA, METADATA_OPTION_DEFINITIONS)
@app.route('/')