Fix writing bytes to string-stream

Don't open the file first. We can let the zipfile module handle that.

Contributes to issue CURA-8055.
This commit is contained in:
Ghostkeeper 2021-06-09 17:08:57 +02:00
parent ec727e1068
commit 66b2825a66
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -298,8 +298,7 @@ class MaterialManagementModel(QObject):
def exportAll(self, file_path: QUrl) -> None:
registry = CuraContainerRegistry.getInstance()
with open(file_path.toLocalFile(), "w") as stream:
archive = zipfile.ZipFile(stream, "w", compression = zipfile.ZIP_DEFLATED)
archive = zipfile.ZipFile(file_path.toLocalFile(), "w")
for metadata in registry.findInstanceContainersMetadata(type = "material"):
if metadata["base_file"] != metadata["id"]: # Only process base files.
continue