From 709309a50ed2e1e367f7a0e03cb1b5416677c59d Mon Sep 17 00:00:00 2001 From: Andrej Valek Date: Tue, 26 Nov 2024 20:05:49 +0100 Subject: [PATCH] fix(check_order_number): catch system exceptions 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 e40d805..77fa674 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."""