[mousetrap] BugFix



commit b93fbb8041a1109d063d35c89e531252cccda64c
Author: Flavio Percoco Premoli <flaper87 gmail com>
Date:   Sat Mar 27 03:16:23 2010 +0100

    BugFix

 src/mousetrap/app/addons/handler.py |   16 ++++++++++------
 src/mousetrap/ocvfw/pocv.py         |   13 ++++++++-----
 2 files changed, 18 insertions(+), 11 deletions(-)
---
diff --git a/src/mousetrap/app/addons/handler.py b/src/mousetrap/app/addons/handler.py
index 6bdf357..aa97c8b 100644
--- a/src/mousetrap/app/addons/handler.py
+++ b/src/mousetrap/app/addons/handler.py
@@ -54,12 +54,16 @@ class AddonsHandler(object):
         - self: The main object pointer.
         - addon: The addon to explore.
         """
-        tmp = __import__("mousetrap.app.addons.%s" % addon,
-                      globals(),
-                      locals(),
-                      [''])
-        
-        return { "name" : tmp.a_name, "dsc" : tmp.a_description, "stgs" : tmp.a_settings}
+        try:
+            tmp = __import__("mousetrap.app.addons.%s" % addon,
+                          globals(),
+                          locals(),
+                          [''])
+            
+            return { "name" : tmp.a_name, "dsc" : tmp.a_description, "stgs" : tmp.a_settings}
+        except:
+            print("Problems loading mousetrap.app.addons.%s" % addon)
+            
 
 class AddonsBase(object):
 
diff --git a/src/mousetrap/ocvfw/pocv.py b/src/mousetrap/ocvfw/pocv.py
index c51965a..fb89041 100644
--- a/src/mousetrap/ocvfw/pocv.py
+++ b/src/mousetrap/ocvfw/pocv.py
@@ -48,9 +48,12 @@ def get_idms_list():
     return [ mod[0] for mod in [ reg.findall(f) for f in os.listdir("%s/idm/" % dirname)] if mod ]
 
 def get_idm_inf(idm):
-    tmp = __import__("mousetrap.ocvfw.idm.%s" % idm,
-                      globals(),
-                      locals(),
-                      [''])
-    return { "name" : tmp.a_name, "dsc" : tmp.a_description, "stgs" : tmp.a_settings}
+    try:
+        tmp = __import__("mousetrap.ocvfw.idm.%s" % idm,
+                          globals(),
+                          locals(),
+                          [''])
+        return { "name" : tmp.a_name, "dsc" : tmp.a_description, "stgs" : tmp.a_settings}
+    except:
+        print("Problems loading mousetrap.ocvfw.idm.%s" % idm)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]