From 97ff9a0d09df07a0e1b58f1ee60d478be3d482c5 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Sun, 16 Apr 2023 09:00:02 -0300 Subject: [PATCH] [PcbDraw] Better error when a style is missing - Now we don't lie about using a path if the name is absolute --- kibot/PcbDraw/plot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kibot/PcbDraw/plot.py b/kibot/PcbDraw/plot.py index 65fbea66..98783ee7 100644 --- a/kibot/PcbDraw/plot.py +++ b/kibot/PcbDraw/plot.py @@ -1174,8 +1174,10 @@ class PcbPlotter(): """ path = self._find_data_file(name, ".json", "styles") if path is None: - raise RuntimeError(f"Cannot locate resource {name}; explored paths:\n" - + "\n".join([f"- {x}" for x in self.data_path])) + err_msg = "Cannot locate resource "+name + if not os.path.isabs(name): + err_msg += "; explored paths:\n"+"\n".join([f"- {x}" for x in self.data_path]) + raise RuntimeError(err_msg) self.style = load_style(path) def unique_prefix(self) -> str: