win32com python AttributeError!

Discussion in 'Python' started by Michael, Mar 31, 2009.

  1. Michael

    Michael Guest

    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
     
    Michael, Mar 31, 2009
    #1
    1. Advertising

  2. On Mar 30, 11: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


    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
     
    Mike Driscoll, Mar 31, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rebecca Taylor

    win32com python AttributeError!

    Rebecca Taylor, Sep 8, 2003, in forum: Python
    Replies:
    0
    Views:
    930
    Rebecca Taylor
    Sep 8, 2003
  2. Reinhard Koenig
    Replies:
    5
    Views:
    523
    Reinhard Koenig
    Nov 17, 2003
  3. kbperry
    Replies:
    5
    Views:
    870
    kbperry
    Apr 21, 2006
  4. Mark Hammond

    Re: win32com python AttributeError!

    Mark Hammond, Apr 1, 2009, in forum: Python
    Replies:
    0
    Views:
    433
    Mark Hammond
    Apr 1, 2009
  5. Jaydeep Patil
    Replies:
    3
    Views:
    74
    Stefan Schukat
    Feb 13, 2014
Loading...

Share This Page