If you open an IE browser before running the above code, it will run normally and no error will be reported.
However, if you run the above code directly without opening an IE browser in advance, an error will be reported.
Please take a look at the reason?
How to do it?
Environment:
windows7 64-bit
python 2.7.12 32-bit
Code:
from PAM30 import PAMIE
def d():
ie = PAMIE()
ie.navigate('http://pamie.sourceforge.net/pamieform.html')
The error message is as follows:
Traceback (most recent call last): File "D:/jianguoyun/pythonProgrames/myModule/test/pamieTest/pamie-f.py", line 37, in <module> d() File "D:/jianguoyun/pythonProgrames/myModule/test/pamieTest/pamie-f.py", line 9, in d ie = PAMIE() File "D:\jianguoyun\pythonProgrames\myModule\PAM30.py", line 68, in __init__ self._ie = win32com.client.dynamic.Dispatch('InternetExplorer.Application') File "D:\Python27\lib\site-packages\win32com\client\dynamic.py", line 127, in Dispatch IDispatch, userName = _GetGoodDispatchAndUserName(IDispatch,userName,clsctx) File "D:\Python27\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "D:\Python27\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) pywintypes.com_error: (-2147221164, '\xc3\xbb\xd3\xd0\xd7\xa2\xb2\xe1\xc0\xe0', None, None)
ringa_lee2017-05-27 17:41:21
It seems that the InternetExplorer.Application class cannot be found. It is estimated that your IE version is not the default IE8