win32com python AttributeError!

Mark Hammond skippy.hammond at gmail.com
Wed Apr 1 02:42:39 CEST 2009


My guess is that you have a hidden instance of excel running (ie, 
without a window).  Check the task manager for instances of excel.exe 
and kill them.

Cheers,

Mark

On 31/03/2009 3:17 PM, Michael wrote:
> Hi Python-list -
>
> Has anyone figured this out from Rebecca:
>
>
> Hi, I am having trouble with win32com for python.  I get the following
> error when I try to issue any command after using Dispatch.
>
>>>> xl=win32com.client.Dispatch("Excel.Application")
>>>> xl.Visible=0
> Traceback (most recent call last):
>    File "<pyshell#7>", line 1, in ?
>      xl.Visible=0
>    File "D:\Python22\Lib\site-packages\win32com\client\dynamic.py",
> line 504, in __setattr__
>      raise AttributeError, "Property '%s.%s' can not be set." %
> (self._username_, attr)
> AttributeError: Property 'Excel.Application.Visible' can not be set.
>
> I have programs that I used to use all the time and they simply won't
> run.  Is this an error with python or win32com or my setup?
>
> Thanks,
> -rebecca
>
> I have the same problem.
>
> Thus,
>
> myWord = Dispatch("Word.Application")
> myWord.Visible = 1   # or, True
>
> opens a word document but
>
> myExcel = Dispatch("Excel.Application")
> myExcel.Visible = 1    # or, True
>
> causes (as Rebecca notes above):
>
> AttributeError: Property 'Excel.Application.Visible' can
> not be set.
>
>
>
> Thanks,
>
> Michael
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list