[python-win32] bug with CastTo and py2exe

Patricio Stegmann kpoman at hotmail.com
Mon Aug 31 02:39:53 CEST 2009


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.

_________________________________________________________________
Share your memories online with anyone you want.
http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20090830/93d7fd16/attachment.htm>


More information about the python-win32 mailing list