Skip to content

Commit 9ce340f

Browse files
committed
Making the escape for the warning less broad
1 parent b289423 commit 9ce340f

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

cq_editor/widgets/editor.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -549,15 +549,14 @@ def get_imported_module_paths(self, module_path):
549549
except SyntaxError as err:
550550
self._logger.warning(f"Syntax error in {module_path}: {err}")
551551
except Exception as err:
552+
# Suppress PyInstaller-specific module finder error
553+
if isinstance(err, AttributeError) and "is_package" in str(err):
554+
pass
552555
# The module finder has trouble when CadQuery is imported in the top level script and in
553556
# imported modules. The warning about it can be ignored.
554-
if (
555-
(isinstance(err, AttributeError) and "is_package" in str(err))
556-
or ("cadquery" not in finder.badmodules)
557-
or ("cadquery" in finder.badmodules and len(finder.badmodules) > 1)
557+
elif "cadquery" not in finder.badmodules or (
558+
"cadquery" in finder.badmodules and len(finder.badmodules) > 1
558559
):
559-
pass
560-
else:
561560
self._logger.warning(
562561
f"Cannot determine imported modules in {module_path}: {type(err).__name__} {err}"
563562
)

0 commit comments

Comments
 (0)