From 6737dfac470f80f358926c63490a40976a9997ca Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 28 Jun 2018 16:09:00 +0200 Subject: [PATCH] Protect against crashes when the temporary file is still in use by another process. Contributes to CURA-5516. --- cura/CuraPackageManager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index c7cb1b96bf..59a9231bd1 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -330,7 +330,10 @@ class CuraPackageManager(QObject): self.__installPackageFiles(package_id, src_dir_path, dst_dir_path) # Remove the file - os.remove(filename) + try: + os.remove(filename) + except Exception: + Logger.log("w", "Tried to delete file [%s], but it failed", filename) # Move the info to the installed list of packages only when it succeeds self._installed_package_dict[package_id] = self._to_install_package_dict[package_id]