开发者

Python win32com: Internet Explorer COM object ? (used to work?)

I have this very simple program:

from win32com import client
ie=client.Dispatch("InternetExplorer.Application")

This used to work (I think I broke something when I re-used 'makepy.py' to try and add in constants for IE).

It still works on another machine where I haven't been so slap-dash with 'makepy.py'.

Here's what I get in an interactive Python session on the non-working machine:

>>> ie
>>> <win32com.gen_py.Microsoft Internet Controls.IWebBrowser2 instance at 0x14701432
>
>>> ie.Visible=True
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\Python26\lib\site-packages\win32com\client\__init__.py", line 471, in
 __setat开发者_JAVA百科tr__
    self._oleobj_.Invoke(*(args + (value,) + defArgs))
pywintypes.com_error: (-2147352573, 'Member not found.', None, None)

And the same on a working machine:

>>> from win32com import client
>>> ie=client.Dispatch("InternetExplorer.Application")
>>> ie
>>> <ComObject InternetExplorer.Application>
>>> ie.Visible=1 # This then brings up IE correctly.

How do I get this working again ? Or am I using the wrong way of launching IE ?

Thanks !


Went into here:

Python26\Lib\site-packages\win32com\gen_py

Renamed the .py and .pyc file to .py_ and .pyc_ files :

85CC894D-5673-4868-9A22-9E15B7E694D3x0x1x1.pyc

Restarted Python: now get the Internet Explorer. phew...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜