Hi to all,

I am encountering a problem which seems like a bug when using the CastTo method.

Basically see this test (msiecontrols is a generated module, initially named B025F75A-CD86-4D11-A0C8-D7644FDBFB5Ax0x1x0.py or """Microsoft Internet Controls""").


testie.py
-------------------------
import msiecontrols
import win32com

l__iev1 = msiecontrols.InternetExplorer()
l__iev2 = win32com.client.CastTo(l__iev1, 'IWebBrowserApp')
print 'ok'
-------------------------

This, executed on command line python testie.py gives as expected:

C:\tmp\cap>python test_ie.py
ok

C:\tmp\cap>


But when doing a py2exe of it with this script:

build_binary.py
-------------------------
from distutils.core import setup
import py2exe
import sys

if len(sys.argv) == 1:
    sys.argv.append("py2exe")

setup( options = {"py2exe": {"compressed": 1, "optimize": 2}},zipfile = 'libfiles.zip', console = [{"script": 'test_ie.py'}] )
-------------------------

I get this when executing:

C:\tmp\cap\dist>test_ie.exe
Traceback (most recent call last):
  File "test_ie.py", line 5, in <module>
  File "win32com\client\__init__.pyo", line 147, in CastTo
AttributeError: 'NoneType' object has no attribute 'CLSID'

C:\tmp\cap\dist>



Please can someone point me to a little light on this ? This happens whenever I use CastTo.

See all the ways you can stay connected to friends and family