From a56489b8855357d0fb8c6cfba93c2c3b66cbe74f Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Thu, 2 Jul 2020 17:19:21 +0200 Subject: [PATCH 1/8] Exclude non-printing nodes from ufp export CURA-6915 --- plugins/UFPWriter/UFPWriter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/UFPWriter/UFPWriter.py b/plugins/UFPWriter/UFPWriter.py index c422dde612..5d645f4823 100644 --- a/plugins/UFPWriter/UFPWriter.py +++ b/plugins/UFPWriter/UFPWriter.py @@ -152,7 +152,10 @@ class UFPWriter(MeshWriter): To retrieve, use: `archive.getMetadata(METADATA_OBJECTS_PATH)` """ objects_model = CuraApplication.getInstance().getObjectsModel() - object_metas = [{"name": item["name"]} for item in objects_model.items] + object_metas = [{"name": item["name"]} + for item in objects_model.items + if item["node"].getMeshData() is not None and not item["node"].callDecoration("isNonPrintingMesh") + ] data = {METADATA_OBJECTS_PATH: object_metas} archive.setMetadata(data) From ead0594c56ae3b79765c8574a4bf9a3186dbce6a Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 3 Jul 2020 09:56:28 +0200 Subject: [PATCH 2/8] Write group content metadata for ufp export CURA-6915 --- plugins/UFPWriter/UFPWriter.py | 88 +++++++++++++++++++++------------- 1 file changed, 56 insertions(+), 32 deletions(-) diff --git a/plugins/UFPWriter/UFPWriter.py b/plugins/UFPWriter/UFPWriter.py index 5d645f4823..2d37378155 100644 --- a/plugins/UFPWriter/UFPWriter.py +++ b/plugins/UFPWriter/UFPWriter.py @@ -1,18 +1,19 @@ -#Copyright (c) 2020 Ultimaker B.V. -#Cura is released under the terms of the LGPLv3 or higher. +# Copyright (c) 2020 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. -from typing import cast +from typing import cast, List, Dict -from Charon.VirtualFile import VirtualFile #To open UFP files. -from Charon.OpenMode import OpenMode #To indicate that we want to write to UFP files. -from io import StringIO #For converting g-code to bytes. +from Charon.VirtualFile import VirtualFile # To open UFP files. +from Charon.OpenMode import OpenMode # To indicate that we want to write to UFP files. +from io import StringIO # For converting g-code to bytes. from UM.Logger import Logger -from UM.Mesh.MeshWriter import MeshWriter #The writer we need to implement. +from UM.Mesh.MeshWriter import MeshWriter # The writer we need to implement. from UM.MimeTypeDatabase import MimeTypeDatabase, MimeType -from UM.PluginRegistry import PluginRegistry #To get the g-code writer. +from UM.PluginRegistry import PluginRegistry # To get the g-code writer. from PyQt5.QtCore import QBuffer +from UM.Scene.SceneNode import SceneNode from cura.CuraApplication import CuraApplication from cura.Snapshot import Snapshot from cura.Utils.Threading import call_on_qt_thread @@ -26,13 +27,13 @@ catalog = i18nCatalog("cura") class UFPWriter(MeshWriter): def __init__(self): - super().__init__(add_to_recent_files = False) + super().__init__(add_to_recent_files=False) MimeTypeDatabase.addMimeType( MimeType( - name = "application/x-ufp", - comment = "Ultimaker Format Package", - suffixes = ["ufp"] + name="application/x-ufp", + comment="Ultimaker Format Package", + suffixes=["ufp"] ) ) @@ -42,7 +43,7 @@ class UFPWriter(MeshWriter): # must be called from the main thread because of OpenGL Logger.log("d", "Creating thumbnail image...") try: - self._snapshot = Snapshot.snapshot(width = 300, height = 300) + self._snapshot = Snapshot.snapshot(width=300, height=300) except Exception: Logger.logException("w", "Failed to create snapshot image") self._snapshot = None # Failing to create thumbnail should not fail creation of UFP @@ -52,29 +53,30 @@ class UFPWriter(MeshWriter): # Qt thread. The File read/write operations right now are executed on separated threads because they are scheduled # by the Job class. @call_on_qt_thread - def write(self, stream, nodes, mode = MeshWriter.OutputMode.BinaryMode): + def write(self, stream, nodes, mode=MeshWriter.OutputMode.BinaryMode): archive = VirtualFile() archive.openStream(stream, "application/x-ufp", OpenMode.WriteOnly) self._writeObjectList(archive) - #Store the g-code from the scene. - archive.addContentType(extension = "gcode", mime_type = "text/x-gcode") - gcode_textio = StringIO() #We have to convert the g-code into bytes. + # Store the g-code from the scene. + archive.addContentType(extension="gcode", mime_type="text/x-gcode") + gcode_textio = StringIO() # We have to convert the g-code into bytes. gcode_writer = cast(MeshWriter, PluginRegistry.getInstance().getPluginObject("GCodeWriter")) success = gcode_writer.write(gcode_textio, None) - if not success: #Writing the g-code failed. Then I can also not write the gzipped g-code. + if not success: # Writing the g-code failed. Then I can also not write the gzipped g-code. self.setInformation(gcode_writer.getInformation()) return False gcode = archive.getStream("/3D/model.gcode") gcode.write(gcode_textio.getvalue().encode("UTF-8")) - archive.addRelation(virtual_path = "/3D/model.gcode", relation_type = "http://schemas.ultimaker.org/package/2018/relationships/gcode") + archive.addRelation(virtual_path="/3D/model.gcode", + relation_type="http://schemas.ultimaker.org/package/2018/relationships/gcode") self._createSnapshot() - #Store the thumbnail. + # Store the thumbnail. if self._snapshot: - archive.addContentType(extension = "png", mime_type = "image/png") + archive.addContentType(extension="png", mime_type="image/png") thumbnail = archive.getStream("/Metadata/thumbnail.png") thumbnail_buffer = QBuffer() @@ -83,7 +85,9 @@ class UFPWriter(MeshWriter): thumbnail_image.save(thumbnail_buffer, "PNG") thumbnail.write(thumbnail_buffer.data()) - archive.addRelation(virtual_path = "/Metadata/thumbnail.png", relation_type = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail", origin = "/3D/model.gcode") + archive.addRelation(virtual_path="/Metadata/thumbnail.png", + relation_type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail", + origin="/3D/model.gcode") else: Logger.log("d", "Thumbnail not created, cannot save it") @@ -97,7 +101,7 @@ class UFPWriter(MeshWriter): material_mime_type = "application/x-ultimaker-material-profile" try: - archive.addContentType(extension = material_extension, mime_type = material_mime_type) + archive.addContentType(extension=material_extension, mime_type=material_mime_type) except: Logger.log("w", "The material extension: %s was already added", material_extension) @@ -116,9 +120,10 @@ class UFPWriter(MeshWriter): continue material_root_id = material.getMetaDataEntry("base_file") - material_root_query = container_registry.findContainers(id = material_root_id) + material_root_query = container_registry.findContainers(id=material_root_id) if not material_root_query: - Logger.log("e", "Cannot find material container with root id {root_id}".format(root_id = material_root_id)) + Logger.log("e", + "Cannot find material container with root id {root_id}".format(root_id=material_root_id)) return False material_container = material_root_query[0] @@ -130,9 +135,9 @@ class UFPWriter(MeshWriter): material_file = archive.getStream(material_file_name) material_file.write(serialized_material.encode("UTF-8")) - archive.addRelation(virtual_path = material_file_name, - relation_type = "http://schemas.ultimaker.org/package/2018/relationships/material", - origin = "/3D/model.gcode") + archive.addRelation(virtual_path=material_file_name, + relation_type="http://schemas.ultimaker.org/package/2018/relationships/material", + origin="/3D/model.gcode") added_materials.append(material_file_name) @@ -151,11 +156,30 @@ class UFPWriter(MeshWriter): To retrieve, use: `archive.getMetadata(METADATA_OBJECTS_PATH)` """ + objects_model = CuraApplication.getInstance().getObjectsModel() - object_metas = [{"name": item["name"]} - for item in objects_model.items - if item["node"].getMeshData() is not None and not item["node"].callDecoration("isNonPrintingMesh") - ] + object_metas = [] + + for item in objects_model.items: + object_metas = object_metas + UFPWriter._getObjectMetas(item["node"]) data = {METADATA_OBJECTS_PATH: object_metas} archive.setMetadata(data) + + @staticmethod + def _getObjectMetas(node: SceneNode) -> List[Dict]: + """Get object metadata to write for a Node. + + :return: List of object metadata dictionaries. + Might contain > 1 element in case of a group node. + Might be empty in case of nonPrintingMesh + """ + + nodes = [node] + if node.callDecoration("isGroup"): + nodes = nodes + node.getAllChildren() # all descendants + + return [{"name": item.getName()} + for item in nodes + if item.getMeshData() is not None and not item.callDecoration("isNonPrintingMesh") + ] From fe7e89835ba1b57c9c248535c0bb979aca69dbbe Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 3 Jul 2020 14:39:05 +0200 Subject: [PATCH 3/8] Version upgrade for jobname_prefix -> job_name_template CURA-5479 --- .../VersionUpgrade462to47/VersionUpgrade462to47.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/VersionUpgrade/VersionUpgrade462to47/VersionUpgrade462to47.py b/plugins/VersionUpgrade/VersionUpgrade462to47/VersionUpgrade462to47.py index 7bee545c16..a6a7fb57cc 100644 --- a/plugins/VersionUpgrade/VersionUpgrade462to47/VersionUpgrade462to47.py +++ b/plugins/VersionUpgrade/VersionUpgrade462to47/VersionUpgrade462to47.py @@ -4,6 +4,8 @@ import configparser from typing import Tuple, List, Dict import io + +from UM.Util import parseBool from UM.VersionUpgrade import VersionUpgrade @@ -28,6 +30,13 @@ class VersionUpgrade462to47(VersionUpgrade): # Update version number. parser["metadata"]["setting_version"] = "15" + if "cura" in parser and "jobname_prefix" in parser["cura"]: + if not parseBool(parser["cura"]["jobname_prefix"]): + parser["cura"]["job_name_template"] = "{project_name}" + del parser["cura"]["jobname_prefix"] + # else: When the jobname_prefix preference is True or not set, + # the default value for job_name_template ("{machine_name_short}_{project_name}") will be used + result = io.StringIO() parser.write(result) return [filename], [result.getvalue()] From 6cfdda0842a801704e15b877d9836b3638a02a6c Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 3 Jul 2020 14:42:08 +0200 Subject: [PATCH 4/8] Apply suggestions from code review CURA-6915 Co-authored-by: Jaime van Kessel --- plugins/UFPWriter/UFPWriter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/UFPWriter/UFPWriter.py b/plugins/UFPWriter/UFPWriter.py index 2d37378155..aef10eafe5 100644 --- a/plugins/UFPWriter/UFPWriter.py +++ b/plugins/UFPWriter/UFPWriter.py @@ -161,13 +161,13 @@ class UFPWriter(MeshWriter): object_metas = [] for item in objects_model.items: - object_metas = object_metas + UFPWriter._getObjectMetas(item["node"]) + object_metas.extend(UFPWriter._getObjectMetas(item["node"])) data = {METADATA_OBJECTS_PATH: object_metas} archive.setMetadata(data) @staticmethod - def _getObjectMetas(node: SceneNode) -> List[Dict]: + def _getObjectMetas(node: SceneNode) -> List[Dict[str, str]]: """Get object metadata to write for a Node. :return: List of object metadata dictionaries. From b1cc651a6a3eecdfdfc2bb714fabbab2a714cc0f Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 3 Jul 2020 14:46:59 +0200 Subject: [PATCH 5/8] Use DepthFirstIterator to get all descendant Nodes CURA-6915 --- plugins/UFPWriter/UFPWriter.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/UFPWriter/UFPWriter.py b/plugins/UFPWriter/UFPWriter.py index 2d37378155..4473a602ae 100644 --- a/plugins/UFPWriter/UFPWriter.py +++ b/plugins/UFPWriter/UFPWriter.py @@ -13,6 +13,7 @@ from UM.MimeTypeDatabase import MimeTypeDatabase, MimeType from UM.PluginRegistry import PluginRegistry # To get the g-code writer. from PyQt5.QtCore import QBuffer +from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Scene.SceneNode import SceneNode from cura.CuraApplication import CuraApplication from cura.Snapshot import Snapshot @@ -175,11 +176,7 @@ class UFPWriter(MeshWriter): Might be empty in case of nonPrintingMesh """ - nodes = [node] - if node.callDecoration("isGroup"): - nodes = nodes + node.getAllChildren() # all descendants - return [{"name": item.getName()} - for item in nodes + for item in DepthFirstIterator(node) if item.getMeshData() is not None and not item.callDecoration("isNonPrintingMesh") ] From 72310919c3748eb91832b1e5494161123a430e2d Mon Sep 17 00:00:00 2001 From: Kostas Karmas Date: Mon, 6 Jul 2020 11:08:33 +0200 Subject: [PATCH 6/8] Fix coding style CURA-6915 --- plugins/UFPWriter/UFPWriter.py | 45 ++++++++++++++++------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/plugins/UFPWriter/UFPWriter.py b/plugins/UFPWriter/UFPWriter.py index 654aae7526..6179872b2d 100644 --- a/plugins/UFPWriter/UFPWriter.py +++ b/plugins/UFPWriter/UFPWriter.py @@ -28,13 +28,13 @@ catalog = i18nCatalog("cura") class UFPWriter(MeshWriter): def __init__(self): - super().__init__(add_to_recent_files=False) + super().__init__(add_to_recent_files = False) MimeTypeDatabase.addMimeType( MimeType( - name="application/x-ufp", - comment="Ultimaker Format Package", - suffixes=["ufp"] + name = "application/x-ufp", + comment = "Ultimaker Format Package", + suffixes = ["ufp"] ) ) @@ -44,7 +44,7 @@ class UFPWriter(MeshWriter): # must be called from the main thread because of OpenGL Logger.log("d", "Creating thumbnail image...") try: - self._snapshot = Snapshot.snapshot(width=300, height=300) + self._snapshot = Snapshot.snapshot(width = 300, height = 300) except Exception: Logger.logException("w", "Failed to create snapshot image") self._snapshot = None # Failing to create thumbnail should not fail creation of UFP @@ -54,14 +54,14 @@ class UFPWriter(MeshWriter): # Qt thread. The File read/write operations right now are executed on separated threads because they are scheduled # by the Job class. @call_on_qt_thread - def write(self, stream, nodes, mode=MeshWriter.OutputMode.BinaryMode): + def write(self, stream, nodes, mode = MeshWriter.OutputMode.BinaryMode): archive = VirtualFile() archive.openStream(stream, "application/x-ufp", OpenMode.WriteOnly) self._writeObjectList(archive) # Store the g-code from the scene. - archive.addContentType(extension="gcode", mime_type="text/x-gcode") + archive.addContentType(extension = "gcode", mime_type = "text/x-gcode") gcode_textio = StringIO() # We have to convert the g-code into bytes. gcode_writer = cast(MeshWriter, PluginRegistry.getInstance().getPluginObject("GCodeWriter")) success = gcode_writer.write(gcode_textio, None) @@ -70,14 +70,13 @@ class UFPWriter(MeshWriter): return False gcode = archive.getStream("/3D/model.gcode") gcode.write(gcode_textio.getvalue().encode("UTF-8")) - archive.addRelation(virtual_path="/3D/model.gcode", - relation_type="http://schemas.ultimaker.org/package/2018/relationships/gcode") + archive.addRelation(virtual_path = "/3D/model.gcode", relation_type = "http://schemas.ultimaker.org/package/2018/relationships/gcode") self._createSnapshot() # Store the thumbnail. if self._snapshot: - archive.addContentType(extension="png", mime_type="image/png") + archive.addContentType(extension = "png", mime_type = "image/png") thumbnail = archive.getStream("/Metadata/thumbnail.png") thumbnail_buffer = QBuffer() @@ -86,9 +85,9 @@ class UFPWriter(MeshWriter): thumbnail_image.save(thumbnail_buffer, "PNG") thumbnail.write(thumbnail_buffer.data()) - archive.addRelation(virtual_path="/Metadata/thumbnail.png", - relation_type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail", - origin="/3D/model.gcode") + archive.addRelation(virtual_path = "/Metadata/thumbnail.png", + relation_type = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail", + origin = "/3D/model.gcode") else: Logger.log("d", "Thumbnail not created, cannot save it") @@ -102,7 +101,7 @@ class UFPWriter(MeshWriter): material_mime_type = "application/x-ultimaker-material-profile" try: - archive.addContentType(extension=material_extension, mime_type=material_mime_type) + archive.addContentType(extension = material_extension, mime_type = material_mime_type) except: Logger.log("w", "The material extension: %s was already added", material_extension) @@ -121,10 +120,9 @@ class UFPWriter(MeshWriter): continue material_root_id = material.getMetaDataEntry("base_file") - material_root_query = container_registry.findContainers(id=material_root_id) + material_root_query = container_registry.findContainers(id = material_root_id) if not material_root_query: - Logger.log("e", - "Cannot find material container with root id {root_id}".format(root_id=material_root_id)) + Logger.log("e", "Cannot find material container with root id {root_id}".format(root_id = material_root_id)) return False material_container = material_root_query[0] @@ -136,9 +134,9 @@ class UFPWriter(MeshWriter): material_file = archive.getStream(material_file_name) material_file.write(serialized_material.encode("UTF-8")) - archive.addRelation(virtual_path=material_file_name, - relation_type="http://schemas.ultimaker.org/package/2018/relationships/material", - origin="/3D/model.gcode") + archive.addRelation(virtual_path = material_file_name, + relation_type = "http://schemas.ultimaker.org/package/2018/relationships/material", + origin = "/3D/model.gcode") added_materials.append(material_file_name) @@ -162,13 +160,13 @@ class UFPWriter(MeshWriter): object_metas = [] for item in objects_model.items: - object_metas.extend(UFPWriter._getObjectMetas(item["node"])) + object_metas.extend(UFPWriter._getObjectMetadata(item["node"])) data = {METADATA_OBJECTS_PATH: object_metas} archive.setMetadata(data) @staticmethod - def _getObjectMetas(node: SceneNode) -> List[Dict[str, str]]: + def _getObjectMetadata(node: SceneNode) -> List[Dict[str, str]]: """Get object metadata to write for a Node. :return: List of object metadata dictionaries. @@ -178,5 +176,4 @@ class UFPWriter(MeshWriter): return [{"name": item.getName()} for item in DepthFirstIterator(node) - if item.getMeshData() is not None and not item.callDecoration("isNonPrintingMesh") - ] + if item.getMeshData() is not None and not item.callDecoration("isNonPrintingMesh")] From 3032221b70118b7f9bfde30c62c2d1eba7e33d00 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 6 Jul 2020 17:23:58 +0200 Subject: [PATCH 7/8] Prevent division by 0 if total download size is 0 This can happen if the downloads are all so small that it gets rounded to 0kB. Fixes Sentry issue CURA-ZM. --- cura/PrinterOutput/Models/ExtruderOutputModel.py | 2 +- cura_app.py | 4 ++-- plugins/Toolbox/src/CloudSync/DownloadPresenter.py | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cura/PrinterOutput/Models/ExtruderOutputModel.py b/cura/PrinterOutput/Models/ExtruderOutputModel.py index 9da3a7117d..bcd0f579c2 100644 --- a/cura/PrinterOutput/Models/ExtruderOutputModel.py +++ b/cura/PrinterOutput/Models/ExtruderOutputModel.py @@ -99,7 +99,7 @@ class ExtruderOutputModel(QObject): self._is_preheating = pre_heating self.isPreheatingChanged.emit() - @pyqtProperty(bool, notify=isPreheatingChanged) + @pyqtProperty(bool, notify = isPreheatingChanged) def isPreheating(self) -> bool: return self._is_preheating diff --git a/cura_app.py b/cura_app.py index a78e7cabd1..61fd544f8f 100755 --- a/cura_app.py +++ b/cura_app.py @@ -39,7 +39,7 @@ except ImportError: parser = argparse.ArgumentParser(prog = "cura", add_help = False) parser.add_argument("--debug", - action="store_true", + action = "store_true", default = False, help = "Turn on the debug mode by setting this option." ) @@ -49,7 +49,7 @@ known_args = vars(parser.parse_known_args()[0]) if with_sentry_sdk: sentry_env = "unknown" # Start off with a "IDK" if hasattr(sys, "frozen"): - sentry_env = "production" # A frozen build has the posibility to be a "real" distribution. + sentry_env = "production" # A frozen build has the possibility to be a "real" distribution. if ApplicationMetadata.CuraVersion == "master": sentry_env = "development" # Master is always a development version. diff --git a/plugins/Toolbox/src/CloudSync/DownloadPresenter.py b/plugins/Toolbox/src/CloudSync/DownloadPresenter.py index 635cd89af2..a070065540 100644 --- a/plugins/Toolbox/src/CloudSync/DownloadPresenter.py +++ b/plugins/Toolbox/src/CloudSync/DownloadPresenter.py @@ -120,6 +120,10 @@ class DownloadPresenter: received += item["received"] total += item["total"] + if total == 0: # Total download size is 0, or unknown, or there are no progress items at all. + self._progress_message.setProgress(100.0) + return + self._progress_message.setProgress(100.0 * (received / total)) # [0 .. 100] % def _onError(self, package_id: str) -> None: From c7bbc139f74f12644a3355de8500671879f50fad Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 6 Jul 2020 17:42:04 +0200 Subject: [PATCH 8/8] Catch file writing errors while writing files in the archive Seems really rare to me, but our users get every possible error some day. Fixes Sentry issue CURA-ZW. --- plugins/3MFWriter/ThreeMFWorkspaceWriter.py | 22 ++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py index 4201573c78..2e113e0c4f 100644 --- a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py +++ b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py @@ -127,15 +127,19 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter): file_name = "Cura/%s.%s" % (container.getId(), file_suffix) - if file_name in archive.namelist(): - return # File was already saved, no need to do it again. Uranium guarantees unique ID's, so this should hold. + try: + if file_name in archive.namelist(): + return # File was already saved, no need to do it again. Uranium guarantees unique ID's, so this should hold. - file_in_archive = zipfile.ZipInfo(file_name) - # For some reason we have to set the compress type of each file as well (it doesn't keep the type of the entire archive) - file_in_archive.compress_type = zipfile.ZIP_DEFLATED + file_in_archive = zipfile.ZipInfo(file_name) + # For some reason we have to set the compress type of each file as well (it doesn't keep the type of the entire archive) + file_in_archive.compress_type = zipfile.ZIP_DEFLATED - # Do not include the network authentication keys - ignore_keys = {"network_authentication_id", "network_authentication_key", "octoprint_api_key"} - serialized_data = container.serialize(ignored_metadata_keys = ignore_keys) + # Do not include the network authentication keys + ignore_keys = {"network_authentication_id", "network_authentication_key", "octoprint_api_key"} + serialized_data = container.serialize(ignored_metadata_keys = ignore_keys) - archive.writestr(file_in_archive, serialized_data) + archive.writestr(file_in_archive, serialized_data) + except (FileNotFoundError, EnvironmentError): + Logger.error("File became inaccessible while writing to it: {archive_filename}".format(archive_filename = archive.fp.name)) + return \ No newline at end of file