Heim  >  Fragen und Antworten  >  Hauptteil

windows-7 – Unter Windows 7 meldet PAM30 einen Fehler, wenn Python2.7 den IE-Browser betreibt: pywintypes.com_error?

Wenn Sie einen IE-Browser öffnen, bevor Sie den obigen Code ausführen, wird er normal ausgeführt und es wird kein Fehler gemeldet.
Wenn Sie jedoch den obigen Code direkt ausführen, ohne vorher einen IE-Browser zu öffnen, wird ein Fehler gemeldet.
Bitte schauen Sie sich den Grund an?
Wie geht das?

Umgebung:
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')  

Die Fehlermeldung lautet wie folgt:

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)
过去多啦不再A梦过去多啦不再A梦2672 Tage vor888

Antworte allen(1)Ich werde antworten

  • ringa_lee

    ringa_lee2017-05-27 17:41:21

    看来是找不到InternetExplorer.Application这个类,预计是你的IE版本不为默认的IE8

    Antwort
    0
  • StornierenAntwort