Thread: python com

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Posts
    37
    Rep Power
    10

    python com


    Hopefully this is the correct place to post this... my knowledge of COM is such that I'm not sure though.

    Using win32client.Dispatch(), I can launch 'Excel.Application' and others, but cannot launch 'InternetExplorer.Application'. I don't get an error, but ie doesn't show up on the screen (even when I set visible = 1), and doesn't show up in running processes on the task manager. If I then try to do anything with ie, I get an exception.

    If I have an internet explorer window open, though, I can use a Dispatch(clsid) kind of command to get a handle to one of the already open windows and navigate at will.

    So... I've tried reinstalling win32 extensions to no avail. Anyone know why I can use python to launch other applications but not internet explorer?

    Thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    London, England
    Posts
    1,585
    Rep Power
    1373
    You can launch and control IE using COM, so I don't know why you are having a problem. Perhaps if you posted the exception traceback it will give a clue as to why it is not working.

    You could also try PAMIE, a high level python wrapper around the COM interface to IE.

    Dave - The Developers' Coach

    Comments on this post

    • Zone agrees : thanks
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Posts
    37
    Rep Power
    10
    Thanks for the reply. As for the traceback, I can't post it right now because I can't reproduce it. Now I'm getting some very weird behavior. For example, if I try to do the following in PythonWin:

    >>> import win32com.client as c
    >>> ie = c.Dispatch('InternetExploerer.Application')
    >>> ie.visible = 1

    with Windows Explorer closed, I get normal behavior, with a new Internet Explorer window opening. If I have Windows Explorer open, though, I do not get a new window. It appears at first glance as if nothing has happened. If I then type:

    >>> ie.Navigate('www.yahoo.com')

    I get Yahoo opening in my windows explorer (_NOT_ internet explorer, windows explorer, with the folders and such.) One time, the browser information even got displayed in my PythonWin window.

    This seems very weird, and I'm not sure if it is a windows problem or a python extensions problem... any pointers or advice would be appreciated.

IMN logo majestic logo threadwatch logo seochat tools logo