Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > win32com python AttributeError!

Reply
Thread Tools

win32com python AttributeError!

 
 
Michael
Guest
Posts: n/a
 
      03-31-2009
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


 
Reply With Quote
 
 
 
 
Mike Driscoll
Guest
Posts: n/a
 
      03-31-2009
On Mar 30, 11:17*pm, Michael <(E-Mail Removed)> 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


This works fine for me on Windows XP and Python 2.5. It looks like
Rebecca is using Python 2.2, which might be the issue. I would also
upgrade to the latest PyWin32 as well. I'm using 212.

- Mike
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
win32com (VBScript to Python) problem Tim Howarth Python 13 11-25-2003 05:07 PM
RE: win32com (VBScript to Python) problem Tim Golden Python 1 11-25-2003 01:23 PM
Catching JavaScript in InternetExplorer with Python / win32com Florian Fredegar Haftmann Python 1 11-23-2003 10:07 PM
questions about a C++ COM object accessed in Python via win32com T.T.H. Python 3 09-23-2003 05:47 PM
win32com python AttributeError! Rebecca Taylor Python 0 09-08-2003 02:31 PM



Advertisments