[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 17:46:05 CEST 2012


There almost nothing in C:\Python26\Lib\site-packages\win32com\gen_py.

In a subfolder \00020813-0000-0000-C000-000000000046x0x1x7, I have 30 .py and .pyc, all generated in the last day.

Are you saying that they should be removed?

-Kurt


-----Original Message-----
From: python-win32-bounces+kurt.munson=hbmncode.com at python.org [mailto:python-win32-bounces+kurt.munson=hbmncode.com at python.org] On Behalf Of Graham Bloice
Sent: Tuesday, July 17, 2012 11:31 AM
To: python-win32 at python.org
Subject: Re: [python-win32] new Pywin32 errors stating 'object has no attribute' - and the code worked previously

> -----Original Message-----
> Subject: Re: [python-win32] new Pywin32 errors stating 'object has no
> attribute' - and the code worked previously
>
> On 17/07/2012 16:05, Kurt Munson wrote:
> > Dunno exactly what you mean by "what's your Dispatch code look like".
>
> Well pretty much what you posted, in fact :)
>
> > Incidentally, I tried changing the dispatch line to use dynamic
> > dispatch using this code:
> >
> > <code> xl = win32com.client.dynamic.Dispatch("Excel.Application")
> > </code>
> >
> > ...and I still run into apparent case sensitivity, like not
> > recognizing xl.visible, in lower case.  I thought dynamic dispatch
> > would remove case sensitivity.
>
> So did I:
>
> <dump>
> ActivePython 2.7.1.4 (ActiveState Software Inc.) based on Python 2.7.1
> (r271:86832, Feb  7 2011, 11:30:38) [MSC v.1500 32 Type "help",
"copyright",
> "credits" or "license" for more infor
> >>> import win32com.client
> >>> xl = win32com.client.dynamic.Dispatch("Excel.Application")
> >>> xl.visible
> False
> >>> xl.Visible
> False
> >>>
> >>>
>
> </dump>
>
> whereas:
>
> <dump>
> >>> xl2 = win32com.client.gencache.EnsureDispatch("Excel.Application")
> >>> xl2.visible
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "c:\python27\lib\site-packages\win32com\client\__init__.py",
> line
462,
> in __getattr__
>     raise AttributeError("'%s' object has no attribute '%s'" %
(repr(self), attr))
> AttributeError: '<win32com.gen_py.Microsoft Excel 11.0 Object
> Library._Application instance at 0x58072680>' object has no attribute
'visible'
> >>>
> </dump>
>
>
> Well I'm stumped. Hopefully someone more knowledgeable can chip in.
>
[Graham Bloice said]

Maybe remove the generated early binding .py for Excel in win32com\gen_py _______________________________________________
python-win32 mailing list
python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32

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.


More information about the python-win32 mailing list