[python-win32] new Pywin32 errors stating 'object has no attribute' - and the code worked previously

Kurt Munson kurt.munson at hbmncode.com
Tue Jul 17 15:51:49 CEST 2012


I have been using pywin32 successfully for years to control Excel.  Now, suddenly I get errors executing the same code that has run previously.

My python code controls Excel like this:


import win32com.client
xl = win32com.client.DispatchEx("Excel.Application")
xl.DisplayAlerts = 0
xl.visible = 0


The last line('xl.visible = 0') now causes an error:


<type 'exceptions.AttributeError'>'<win32com.gen_py.Microsoft Excel 14.0 Object Library._Application instance at 0x425283464>' object has no attribute 'visible' [Function: glyphscript Line:63 | Function: __setattr__ Line:470]


This error goes away if I use xl.Visible instead of xl.visible - notice the uppercase V.  But then I get all sorts of other errors, in places that didn't error previously.

Why would this code have worked for years, and then suddenly not work now?

I am using Python 2.6.5 and pywin32-214 on 64 bit Windows 7.  I uninstalled and reinstalled Python and pywin32, but the new errors persist.

-Kurt


________________________________
Confidentiality Notice: This email may contain confidential and/or privileged information. If you are not the intended recipient of this message, please delete it immediately and inform the sender that you have received this message in error.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20120717/f9871399/attachment.html>


More information about the python-win32 mailing list