From 274cbb24e4a8b0c12775d091d04fb8997c5f1b92 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 21 Aug 2009 22:09:20 +0000 Subject: [PATCH] protect against ImportError --- direct/src/showutil/FreezeTool.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/direct/src/showutil/FreezeTool.py b/direct/src/showutil/FreezeTool.py index c48d4a5c04..d64b7555a5 100644 --- a/direct/src/showutil/FreezeTool.py +++ b/direct/src/showutil/FreezeTool.py @@ -612,8 +612,11 @@ class Freezer: path = self.getModulePath(parentName) if path == None: return None - - file, pathname, description = imp.find_module(baseName, path) + + try: + file, pathname, description = imp.find_module(baseName, path) + except ImportError: + return None if not os.path.isdir(pathname): return None @@ -826,7 +829,10 @@ class Freezer: else: # Otherwise, we can just import it normally. - self.mf.import_hook(mdef.moduleName) + try: + self.mf.import_hook(mdef.moduleName) + except ImportError: + print "Unknown module: %s" % (mdef.moduleName) def reset(self): """ After a previous call to done(), this resets the