Another MSIE Python Question

Ralph A. Gable r.gable at mchsi.com
Sun Jun 20 04:54:39 CEST 2004


Here's the stack dump:
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\Python22\lib\ufutil.py", line 661, in updatetocurrent
    getplayerdata(l,i)
  File "C:\Python22\lib\ufutil.py", line 478, in getplayerdata
    ie=Dispatch('InternetExplorer.Application.1')
  File "C:\Python22\lib\site-packages\win32com\client\__init__.py",
line 95, in Dispatch
    dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File "C:\Python22\lib\site-packages\win32com\client\dynamic.py",
line 84, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "C:\Python22\lib\site-packages\win32com\client\dynamic.py",
line 72, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
com_error: (-2147221231, 'ClassFactory cannot supply requested class',
None, None)


Peter Hansen <peter at engcorp.com> wrote in message news:<P8OdnbnGjPRIykndRVn-gQ at powergate.ca>...
> Ralph A. Gable wrote:
> 
> > I am opening MSIE6 with this code:
> > 
> >     ie=Dispatch('InternetExplorer.Application.1')
> >     ie.Navigate(url)
> >     while ie.Busy:
> >         time.sleep(0.1)
> >     ied=ie.Document
> >     while ied.ReadyState != 'complete':
> >         time.sleep(0.1)
> >         
> >     ieh=ied.documentElement.outerHTML
> > 
> > 
> > When opening Word or Excel, and using Dispatch('Word.Application') or 
> > Dispatch('Excel.Application'), the app comes up and is available and can be 
> > brought up on the screen by setting .Visible = 1. When using the above code,
> > IE will not come up. I have to open IE by clicking on its icon and then the
> > above code will work. If I don't do that I get a stack dump and my python
> > program crashes.
> > 
> > Any help would be appreciated.
> 
> Based on the above description, is it possible that the fact
> that you aren't doing "ie.Visible = 1" is responsible?
> 
> Also, please include the traceback when saying that your Python program
> crashes... this usually eliminates whole classes of possible causes,
> and often points directly to the trouble for someone who's been there
> before.
> 
> -Peter



More information about the Python-list mailing list