Skip to content

Commit a1f1f95

Browse files
authored
Supressing a log warning when the package is frozen (#570)
* Supressing a log warning when the package is frozen * Making the escape for the warning less broad
1 parent c6f162f commit a1f1f95

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

cq_editor/widgets/editor.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,9 +549,16 @@ 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 (
554+
getattr(sys, "frozen", False)
555+
and isinstance(err, AttributeError)
556+
and "is_package" in str(err)
557+
):
558+
pass
552559
# The module finder has trouble when CadQuery is imported in the top level script and in
553560
# imported modules. The warning about it can be ignored.
554-
if "cadquery" not in finder.badmodules or (
561+
elif "cadquery" not in finder.badmodules or (
555562
"cadquery" in finder.badmodules and len(finder.badmodules) > 1
556563
):
557564
self._logger.warning(

0 commit comments

Comments
 (0)