From 080c907f34de0c719e4d431f36d6573a7f812d69 Mon Sep 17 00:00:00 2001 From: Andrej Valek Date: Fri, 13 Dec 2024 09:21:48 +0100 Subject: [PATCH] fix(check_order_number): catch system exceptions (#555) When empty board is used, pcbnew.GetBoard().GetFileName() returns FileNotFound exception which was not handled in check_order_number function. Signed-off-by: Andrej Valek --- mainwindow.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mainwindow.py b/mainwindow.py index 80881f1..45b6b20 100644 --- a/mainwindow.py +++ b/mainwindow.py @@ -804,9 +804,13 @@ def select_part(self, *_): def check_order_number(self): """Verify that the JLC order number placeholder is present.""" - with open(self.pcbnew.GetBoard().GetFileName()) as f: - data = f.read() - return "JLCJLCJLCJLC" in data + try: + with open(self.pcbnew.GetBoard().GetFileName()) as f: + data = f.read() + return "JLCJLCJLCJLC" in data + except OSError: + pass + return True def generate_fabrication_data(self, *_): """Generate fabrication data."""