From c661bb62ca2717b86a337fb383b1e7e6f353b948 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 15 Sep 2025 12:01:13 +0200 Subject: [PATCH] Rework header access in exception handling --- src/ifcopenshell-python/ifcopenshell/file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/file.py b/src/ifcopenshell-python/ifcopenshell/file.py index 850ab8c4f6..09496f9be8 100644 --- a/src/ifcopenshell-python/ifcopenshell/file.py +++ b/src/ifcopenshell-python/ifcopenshell/file.py @@ -574,6 +574,7 @@ class file: else: schema = {"IFC4X3": "IFC4X3_ADD2"}.get(schema, schema) if f is not None: + self.wrapped_data = f if not f.good(): from . import Error, SchemaError @@ -582,12 +583,11 @@ class file: NO_HEADER: lambda: (Error, "Unable to parse IFC SPF header"), UNSUPPORTED_SCHEMA: lambda: ( SchemaError, - "Unsupported schema: %s" % ",".join(f.header.file_schema.schema_identifiers), + "Unsupported schema: %s" % ",".join(self.header.file_schema.schema_identifiers), ), INVALID_SYNTAX: lambda: (Error, "Syntax error during parse, check logs"), }[f.good().value()]() raise exc(msg) - self.wrapped_data = f else: args = filter(None, [schema]) args = map(ifcopenshell_wrapper.schema_by_name, args)