[Zope-CVS] CVS: Products/ExternalEditor/Plugins - excel.py:1.5

Chris McDonough chrism at plope.com
Thu Mar 3 19:20:14 EST 2005


Update of /cvs-repository/Products/ExternalEditor/Plugins
In directory cvs.zope.org:/tmp/cvs-serv1927/Plugins

Modified Files:
	excel.py 
Log Message:
Squash intermittent error where an exception is raised out of win32com when the proxy object knows nothing about the attributes we're attempting to look up on it.



=== Products/ExternalEditor/Plugins/excel.py 1.4 => 1.5 ===
--- Products/ExternalEditor/Plugins/excel.py:1.4	Tue Apr 27 16:57:05 2004
+++ Products/ExternalEditor/Plugins/excel.py	Thu Mar  3 19:20:14 2005
@@ -16,7 +16,7 @@
 $Id$
 """
 
-import os
+import os, types
 from time import sleep
 import win32com
 import pythoncom
@@ -70,6 +70,19 @@
                 return 1
             else:
                 raise
+        except AttributeError, why:
+            # No one knows why this happens but sometimes while a user is
+            # editing, win32com\client\dynamic.py will raise an error
+            # signifying that the attributes we attempt to look up on the Excel
+            # document can't be found.  Ignore this and return 1 if so,
+            # waiting for the next go-around to check again (eventually we do
+            # get access to the attributes).
+            if (isinstance(why, types.StringType) or
+                isinstance(why, types.UnicodeType)):
+                if why.endswith('Path') or why.endswith('Name'):
+                    return 1
+            raise
+
 
 def test():
     import os



More information about the Zope-CVS mailing list