[orca/introspection] Handle a pyatspi LookupError more gracefully.



commit d7a2ef45efe3ac35e5fba611d3b80fa5e0f83c3d
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Sun Aug 28 19:42:47 2011 -0400

    Handle a pyatspi LookupError more gracefully.

 src/orca/script_manager.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/script_manager.py b/src/orca/script_manager.py
index 41b3b06..c3ee35f 100644
--- a/src/orca/script_manager.py
+++ b/src/orca/script_manager.py
@@ -85,7 +85,14 @@ class ScriptManager:
     def getModuleName(self, app):
         """Returns the module name of the script to use for application app."""
 
-        if not (app and app.name):
+        try:
+            appAndNameExist = app != None and app.name != ''
+        except (LookupError, RuntimeError):
+            appAndNameExist = False
+            debug.println(debug.LEVEL_SEVERE,
+                          "getModuleName: %s no longer exists" % app)
+
+        if not appAndNameExist:
             return None
 
         # Many python apps have an accessible name which ends in '.py'.



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