mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
Catch environment errors when reading license file from package
The package may be inaccessible for whatever reason, which would crash Cura. New attempt to fix CURA-2RP (without breaking the unit test saying that this error should be raised by Uranium then).
This commit is contained in:
parent
f749bbef46
commit
9e1dc98cd1
2 changed files with 14 additions and 3 deletions
|
@ -1,3 +1,6 @@
|
|||
# Copyright (c) 2021 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import os
|
||||
from collections import OrderedDict
|
||||
from typing import Dict, Optional, List, Any
|
||||
|
@ -95,7 +98,11 @@ class LicensePresenter(QObject):
|
|||
|
||||
for package_id, item in packages.items():
|
||||
item["package_id"] = package_id
|
||||
item["licence_content"] = self._package_manager.getPackageLicense(item["package_path"])
|
||||
try:
|
||||
item["licence_content"] = self._package_manager.getPackageLicense(item["package_path"])
|
||||
except EnvironmentError as e:
|
||||
Logger.error(f"Could not open downloaded package {package_id} to read license file! {type(e)} - {e}")
|
||||
continue # Skip this package.
|
||||
if item["licence_content"] is None:
|
||||
# Implicitly accept when there is no license
|
||||
item["accepted"] = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue