From 0450a3b09c35ebef46ea755d6f450fdacaab73e6 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Tue, 29 Aug 2023 16:45:13 +0200 Subject: [PATCH 1/2] Fixed possibly wrong error message CURA-10180 --- plugins/3MFWriter/ThreeMFWorkspaceWriter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py index 1bc1432b67..89df2eb4f6 100644 --- a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py +++ b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py @@ -98,7 +98,7 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter): Logger.error("No permission to write workspace to this stream.") return False except EnvironmentError as e: - self.setInformation(catalog.i18nc("@error:zip", "The operating system does not allow saving a project file to this location or with this file name.")) + self.setInformation(catalog.i18nc("@error:zip", str(e))) Logger.error("EnvironmentError when writing workspace to this stream: {err}".format(err = str(e))) return False mesh_writer.setStoreArchive(False) From 6848974fcc1f99de639816b211dbf71f7dc6d5b9 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Fri, 1 Sep 2023 10:14:17 +0200 Subject: [PATCH 2/2] 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 89df2eb4f6..e89af5c70a 100644 --- a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py +++ b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py @@ -40,7 +40,9 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter): # 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 3f6fef7201..1ecfd87aa8 100644 --- a/plugins/3MFWriter/ThreeMFWriter.py +++ b/plugins/3MFWriter/ThreeMFWriter.py @@ -237,9 +237,9 @@ class ThreeMFWriter(MeshWriter): 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: