From 3aa4fa580bc31bec5c4e9117fb30fc0848677418 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 7 Feb 2025 12:38:52 +1100 Subject: [PATCH] Fix regression where you couldn't upgrade schema of IFCs with invalid headers --- src/ifcopenshell-python/ifcopenshell/file.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/file.py b/src/ifcopenshell-python/ifcopenshell/file.py index 59ac353107..04c6c2ce50 100644 --- a/src/ifcopenshell-python/ifcopenshell/file.py +++ b/src/ifcopenshell-python/ifcopenshell/file.py @@ -663,7 +663,10 @@ class file: def assign_header_from(self, other: ifcopenshell.file) -> None: for k, vs in HEADER_FIELDS.items(): for v in vs: - setattr(getattr(self.header, k), v, getattr(getattr(other.header, k), v)) + try: + setattr(getattr(self.header, k), v, getattr(getattr(other.header, k), v)) + except: + pass # Header is invalid def write(self, path: "os.PathLike | str", format: Optional[str] = None, zipped: bool = False) -> None: """Write ifc model to file.