Browse Source

Catch environment errors when reading 3MF archive metadata

The file could get deleted in the meanwhile.

Fixes Sentry issue CURA-1CK.
Ghostkeeper 4 years ago
parent
commit
b740fda491
1 changed files with 3 additions and 0 deletions
  1. 3 0
      plugins/3MFReader/ThreeMFWorkspaceReader.py

+ 3 - 0
plugins/3MFReader/ThreeMFWorkspaceReader.py

@@ -805,6 +805,9 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
         except zipfile.BadZipFile:
             Logger.logException("w", "Unable to retrieve metadata from {fname}: 3MF archive is corrupt.".format(fname = file_name))
             return result
+        except EnvironmentError as e:
+            Logger.logException("w", "Unable to retrieve metadata from {fname}: File is inaccessible. Error: {err}".format(fname = file_name, err = str(e)))
+            return result
 
         metadata_files = [name for name in archive.namelist() if name.endswith("plugin_metadata.json")]