javascript execution from Python script

Mark Hammond mhammond at skippinet.com.au
Tue Aug 27 21:27:24 EDT 2002


Matt Gerrans wrote:

> By the way (this should probably be a different thread), is this some
> idiosycracy of my configuration:
> 
> 
>>>>import win32com
>>>>ie = win32com.client.DispatchEx('InternetExplorer.Application.1')
>>>
> Traceback (most recent call last):
>   File "<pyshell#1>", line 1, in ?
>     ie = win32com.client.DispatchEx('InternetExplorer.Application.1')
> AttributeError: 'module' object has no attribute 'client'
> 
>>>>import win32com.client
>>>>ie = win32com.client.DispatchEx('InternetExplorer.Application.1')
>>>
> 
> Why is it necessary to import win32com.client explicitly in this case?

The function you are trying to use is a member of the win32com.client 
module, not directly in win32com.  The implementation details of 
Python's package import mechanism means that this is not *always* 
necessary, but it is always "right".

Mark.




More information about the Python-list mailing list