[PATCH 1/2] Log failed imports in the collect functions

Vratislav Podzimek vpodzime at redhat.com
Mon Mar 4 13:06:27 UTC 2013


Otherwise there is no other way to find out what happened other
than rebooting and using pdb.
---
 pyanaconda/ui/common.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/ui/common.py b/pyanaconda/ui/common.py
index 29c97fe..8248bd5 100644
--- a/pyanaconda/ui/common.py
+++ b/pyanaconda/ui/common.py
@@ -27,6 +27,9 @@ import copy
 import sys
 import types
 
+import logging
+log = logging.getLogger("anaconda")
+
 class PathDict(dict):
     """Dictionary class supporting + operator"""
     def __add__(self, ext):
@@ -556,7 +559,8 @@ def collect(module_pattern, path, pred):
             if not module_flags[0].startswith(".py") and loaded_ext.startswith(".py"):
                 continue
             
-        except ImportError:
+        except ImportError as imperr:
+            log.error("Failed to import module in collect: %s" % imperr)
             continue
         finally:
             imp.release_lock()
-- 
1.7.11.7



More information about the anaconda-patches mailing list