From 53010138733ae50ebd206ba6dbf6d40e54973824 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Sat, 8 Jun 2019 22:19:02 +0200 Subject: [PATCH] Material: card utils, do not fail to return card dicts if reading a card fails --- src/Mod/Material/materialtools/cardutils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Mod/Material/materialtools/cardutils.py b/src/Mod/Material/materialtools/cardutils.py index 445de01295..9487416f19 100644 --- a/src/Mod/Material/materialtools/cardutils.py +++ b/src/Mod/Material/materialtools/cardutils.py @@ -146,7 +146,14 @@ def add_cards_from_a_dir(materials, cards, icons, mat_dir, icon, template=False) # duplicates are indicated on equality of mat dict # TODO if the unit is different two cards would be different too for a_path in dir_path_list: - mat_dict = read(a_path) + try: + mat_dict = read(a_path) + except: + FreeCAD.Console.PrintError( + 'Error on reading card data. The card data will be empty for card:\n{}\n' + .format(a_path) + ) + mat_dict = {} card_name = os.path.splitext(os.path.basename(a_path))[0] if (card_name == 'TEMPLATE') and (template is False): continue