diff --git a/direct/src/showutil/FreezeTool.py b/direct/src/showutil/FreezeTool.py index 9200f132c9..7cfe976edc 100644 --- a/direct/src/showutil/FreezeTool.py +++ b/direct/src/showutil/FreezeTool.py @@ -1116,7 +1116,8 @@ class Freezer: filename = '/'.join(dirnames) module = self.mf.modules.get(mdef.moduleName, None) - if getattr(module, '__path__', None) is not None or getattr(module, '__file__', '').endswith('/__init__.py'): + if getattr(module, '__path__', None) is not None or \ + (getattr(module, '__file__', None) is not None and getattr(module, '__file__').endswith('/__init__.py')): # It's actually a package. In this case, we really write # the file moduleName/__init__.py. filename += '/__init__'