mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Don't crash when the file is deleted while in pre-read phase
The pre-read takes a while since it shows a dialogue. The user has all the time to delete the file or rename it in the meanwhile. Fixes Sentry issue CURA-SG.
This commit is contained in:
parent
7adcce08eb
commit
715e5a890e
1 changed files with 9 additions and 1 deletions
|
@ -589,7 +589,15 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
def read(self, file_name):
|
||||
application = CuraApplication.getInstance()
|
||||
|
||||
archive = zipfile.ZipFile(file_name, "r")
|
||||
try:
|
||||
archive = zipfile.ZipFile(file_name, "r")
|
||||
except EnvironmentError as e:
|
||||
message = Message(i18n_catalog.i18nc("@info:error Don't translate the XML tags <filename> or <message>!",
|
||||
"Project file <filename>{0}</filename> is suddenly inaccessible: <message>{1}</message>.", file_name, str(e)),
|
||||
title = i18n_catalog.i18nc("@info:title", "Can't Open Project File"))
|
||||
message.show()
|
||||
self.setWorkspaceName("")
|
||||
return [], {}
|
||||
|
||||
cura_file_names = [name for name in archive.namelist() if name.startswith("Cura/")]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue