From cd2cac664ec4a18c28da0704869cf41874a65549 Mon Sep 17 00:00:00 2001 From: Glas42 <145870870+Glas42@users.noreply.github.com> Date: Tue, 4 Jun 2024 12:44:09 +0200 Subject: [PATCH] Bug fix in Navigation Detection to prevent spamming crash reports when the code is unable to delete the previous AI model. --- blog/V1.11.Minor.md | 4 +++- changelog.txt | 2 +- plugins/NavigationDetection/main.py | 7 +++++++ version.txt | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/blog/V1.11.Minor.md b/blog/V1.11.Minor.md index 5e498bcfd..9fbfaad35 100644 --- a/blog/V1.11.Minor.md +++ b/blog/V1.11.Minor.md @@ -20,7 +20,9 @@ title: Version 1.11 > Minor This changelog will contain all changes from 1.11.0 onwards before the next major version. !!! - +==- Version 1.11.31 +Bug fix in Navigation Detection to prevent spamming crash reports when the code is unable to delete the previous AI model. +[!badge variant="dark" text="Glas42"] [!badge variant="ghost" text="NavigationDetection"] ==- Version 1.11.30 It's now possible to collect anonymous traffic light images for a new AI model. [!badge variant="dark" text="Glas42"] [!badge variant="ghost" text="TrafficLightDetection"] diff --git a/changelog.txt b/changelog.txt index fc0f69b29..1c7fed0e9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1 +1 @@ -It's now possible to collect anonymous traffic light images for a new AI model. \ No newline at end of file +Bug fix in Navigation Detection to prevent spamming crash reports when the code is unable to delete the previous AI model. \ No newline at end of file diff --git a/plugins/NavigationDetection/main.py b/plugins/NavigationDetection/main.py index 1ed2a5d0f..86eaca8f9 100644 --- a/plugins/NavigationDetection/main.py +++ b/plugins/NavigationDetection/main.py @@ -456,6 +456,13 @@ def DeleteAllAIModels(): for file in os.listdir(f"{variables.PATH}plugins/NavigationDetection/AIModel"): if file.endswith(".pt"): os.remove(os.path.join(f"{variables.PATH}plugins/NavigationDetection/AIModel", file)) + except PermissionError: + global TorchAvailable + TorchAvailable = False + settings.CreateSettings("NavigationDetection", "UseAI", False) + print(f"NavigationDetection - PermissionError in function DeleteAllAIModels: {ex}") + print("NavigationDetectionAI will be automatically disabled because the code cannot delete the AI model.") + console.RestoreConsole() except Exception as ex: exc = traceback.format_exc() SendCrashReport("NavigationDetection - Error in function DeleteAllAIModels.", str(exc)) diff --git a/version.txt b/version.txt index 8b158053e..4cdcd1da0 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.11.30 \ No newline at end of file +1.11.31 \ No newline at end of file