diff --git a/src/pycram/ontology/ontology.py b/src/pycram/ontology/ontology.py index 097673d13..4e7a92d46 100644 --- a/src/pycram/ontology/ontology.py +++ b/src/pycram/ontology/ontology.py @@ -218,9 +218,11 @@ def load_ontology(self, ontology_iri: str) -> Optional[Tuple[Ontology, Namespace rospy.logerr("Ontology IRI is empty") return None - # If `ontology_iri` is a local path -> create an empty ontology file if not existing is_local_ontology_iri = not (ontology_iri.startswith("http:") or ontology_iri.startswith("https:")) + + # If `ontology_iri` is a local path if is_local_ontology_iri and not Path(ontology_iri).exists(): + # -> Create an empty ontology file if not existing with open(ontology_iri, 'w'): pass