From 6848974fcc1f99de639816b211dbf71f7dc6d5b9 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Fri, 1 Sep 2023 10:14:17 +0200 Subject: [PATCH] Fix project write error not reported on Windows CURA-10180 --- plugins/3MFWriter/ThreeMFWorkspaceWriter.py | 4 +++- plugins/3MFWriter/ThreeMFWriter.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py index 89df2eb4f6d..e89af5c70aa 100644 --- a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py +++ b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py @@ -40,7 +40,9 @@ def write(self, stream, nodes, mode=WorkspaceWriter.OutputMode.BinaryMode): # Indicate that the 3mf mesh writer should not close the archive just yet (we still need to add stuff to it). mesh_writer.setStoreArchive(True) - mesh_writer.write(stream, nodes, mode) + if not mesh_writer.write(stream, nodes, mode): + self.setInformation(mesh_writer.getInformation()) + return False archive = mesh_writer.getArchive() if archive is None: # This happens if there was no mesh data to write. diff --git a/plugins/3MFWriter/ThreeMFWriter.py b/plugins/3MFWriter/ThreeMFWriter.py index 3f6fef7201d..1ecfd87aa8f 100644 --- a/plugins/3MFWriter/ThreeMFWriter.py +++ b/plugins/3MFWriter/ThreeMFWriter.py @@ -237,9 +237,9 @@ def write(self, stream, nodes, mode = MeshWriter.OutputMode.BinaryMode) -> bool: archive.writestr(model_file, scene_string) archive.writestr(content_types_file, b' \n' + ET.tostring(content_types)) archive.writestr(relations_file, b' \n' + ET.tostring(relations_element)) - except Exception as e: + except Exception as error: Logger.logException("e", "Error writing zip file") - self.setInformation(catalog.i18nc("@error:zip", "Error writing 3mf file.")) + self.setInformation(str(error)) return False finally: if not self._store_archive: