From 2798bf3b68caf96e7da0f65bd14c55cd8d0c7580 Mon Sep 17 00:00:00 2001 From: Andrej Date: Fri, 30 May 2025 13:16:03 +0500 Subject: [PATCH] ifcopenshell.api.geometry to fail more gracefully with fake-bpy If user has fake-bpy-module for type hints, it will fail with `ImportError: cannot import name 'Vector' from 'mathutils' (unknown location)` instead of `ModuleNotFoundError`. --- src/ifcopenshell-python/ifcopenshell/api/geometry/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/__init__.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/__init__.py index 0f17323634..44728c2902 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/__init__.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/__init__.py @@ -34,7 +34,8 @@ from .add_railing_representation import add_railing_representation try: from .add_representation import add_representation -except ModuleNotFoundError: +except (ModuleNotFoundError, ImportError): + # ImportError - in case if user has fake-bpy modules. pass # Silently fail. This is Blender / Bonsai specific and on its way out. from .add_shape_aspect import add_shape_aspect from .add_slab_representation import add_slab_representation