From 9130659f714143beffcc0d17e2b919b18c5fa76e Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 18 Oct 2024 12:11:11 +0500 Subject: [PATCH] ifcopenshell.open - readable error if file doesn't exist Previously it would show obscure error like: RuntimeError: Type held at index 0 is class Blank and not class std::vector,class std::allocator >,class std::allocator,class std::allocator > > > --- src/ifcopenshell-python/ifcopenshell/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ifcopenshell-python/ifcopenshell/__init__.py b/src/ifcopenshell-python/ifcopenshell/__init__.py index 99b5b737cd..110a38c85b 100644 --- a/src/ifcopenshell-python/ifcopenshell/__init__.py +++ b/src/ifcopenshell-python/ifcopenshell/__init__.py @@ -156,6 +156,8 @@ def open( print(products[0] == model[122] == model["2XQ$n5SLP5MBLyL442paFx"]) # True """ path = Path(path) + if not path.exists(): + raise FileNotFoundError(f"File does not exist: '{path}'.") if format is None: format = guess_format(path) if format == ".ifcXML":