From 430090a65786b0b9dde9e1319a740f95579d0275 Mon Sep 17 00:00:00 2001 From: AndreaGuarracino Date: Wed, 6 Jan 2021 14:09:59 +0100 Subject: avoided using resource_stream, now check_format.py works in CWL --- workflows/yamlfa2ttl/check_format.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/workflows/yamlfa2ttl/check_format.py b/workflows/yamlfa2ttl/check_format.py index a1b1f14..4472b18 100644 --- a/workflows/yamlfa2ttl/check_format.py +++ b/workflows/yamlfa2ttl/check_format.py @@ -1,22 +1,18 @@ import gzip import tempfile -import pkg_resources import magic import io - import sys path_fasta = sys.argv[1] format_to_check = sys.argv[2] path_valid_formats = sys.argv[3] - -# ../../bh20sequploader/validation/formats - -schema_resource = pkg_resources.resource_stream(__name__, path_valid_formats) with tempfile.NamedTemporaryFile() as tmp: - tmp.write(schema_resource.read()) + with open(path_valid_formats, 'rb') as f: + tmp.write(f.read()) tmp.flush() + check_format = magic.Magic(magic_file=tmp.name, uncompress=False, mime=True) with open(path_fasta, "rb") as f: -- cgit v1.2.3