From 2718edb01a340dda7c83dc834b6fe1d084e05f1a Mon Sep 17 00:00:00 2001 From: Tom Gillespie Date: Wed, 12 Jul 2023 11:41:12 -0700 Subject: [PATCH] ontload fix import_tree issues --- pyontutils/ontload.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pyontutils/ontload.py b/pyontutils/ontload.py index 12e841e6..189490a9 100755 --- a/pyontutils/ontload.py +++ b/pyontutils/ontload.py @@ -990,10 +990,14 @@ def run(args): else: ontology = ontologies # FIXME will error - for tree, extra in import_tree(import_graph, ontology): - name = Path(next(iter(tree.keys()))).name - with open(jpth(zip_location, f'{name}-import-closure.html'), 'wt') as f: - f.write(extra.html.replace('NIFTTL:', '')) # much more readable + if ontology.startswith('/'): + ontology = 'file://' + ontology + + for tree, extra in (import_tree(import_graph, ontology),): + if tree is not None: + name = Path(next(iter(tree.keys()))).name + with open(jpth(zip_location, f'{name}-import-closure.html'), 'wt') as f: + f.write(extra.html.replace('NIFTTL:', '')) # much more readable if debug: breakpoint()