From cc014bb7ec99c5f3e300ff451e0aa89760cf5a33 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 27 Nov 2024 12:59:03 +0500 Subject: [PATCH] ifcopenshell.write check if file was saved successfully #5809 will help only for the cases if file didn't existed before --- src/ifcopenshell-python/ifcopenshell/file.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ifcopenshell-python/ifcopenshell/file.py b/src/ifcopenshell-python/ifcopenshell/file.py index db450e3ff0..228c0e9749 100644 --- a/src/ifcopenshell-python/ifcopenshell/file.py +++ b/src/ifcopenshell-python/ifcopenshell/file.py @@ -673,6 +673,8 @@ class file: if format == ".ifcZIP": return self.write(path, ".ifc", zipped=True) self.wrapped_data.write(str(path)) + if not path.exists(): + raise PermissionError(f"Failed to write to '{path}', check folder permissions.") if zipped: unzipped_path = path.with_suffix(format) path.rename(unzipped_path)