[master][PATCH] Fix checking if we are collecting our module

Vratislav Podzimek vpodzime at redhat.com
Tue Dec 10 14:20:55 UTC 2013


module_path may be not defined if an exception is raised early

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/ui/common.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/ui/common.py b/pyanaconda/ui/common.py
index 627ae75..f85a144 100644
--- a/pyanaconda/ui/common.py
+++ b/pyanaconda/ui/common.py
@@ -558,6 +558,7 @@ def collect(module_pattern, path, pred):
 
         mod_info = None
         module = None
+        module_path = None
 
         try:
             imp.acquire_lock()
@@ -627,7 +628,7 @@ def collect(module_pattern, path, pred):
             continue
 
         except ImportError as imperr:
-            if "pyanaconda" in module_path:
+            if module_path and "pyanaconda" in module_path:
                 # failure when importing our own module:
                 raise
             log.error("Failed to import module in collect: %s", imperr)
-- 
1.8.4.2



More information about the anaconda-patches mailing list