Mark,
thanks for you answer !
As you may have noticed the error is pointed to be in line 5, where I do the castto operation, and not on line 4 where I create the object, so I guess it is being correctly imported.
I already did a test with another way of generating, as follows:
------------------------------
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": 'mk4_mso_capture.py'}], typelibs=[('{D258DC95-7CE0-4DF9-8240-089753326083}', 4, 0, 8)] )
------------------------------

and with the gencache + dispatch method, and got the same error, always on the CastTo operation. This is why I pointed out that it may be a bug or something !

> Date: Mon, 31 Aug 2009 12:30:33 +1000
> From: skippy.hammond@gmail.com
> To: kpoman@hotmail.com
> CC: py2exe-users@lists.sourceforge.net
> Subject: Re: [Py2exe-users] py2exe and win32com CastTo bug
>
> You will need to ask py2exe to include generated files for the typelibs
> you are using - see http://www.py2exe.org/index.cgi/IncludingTypelibs
>
> Cheers,
>
> Mark
>
> On 31/08/2009 10:41 AM, Patricio Stegmann wrote:
> > 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
> > <http://www.microsoft.com/windows/windowslive/default.aspx>
> >
> >
> > ------------------------------------------------------------------------
> >
> > ------------------------------------------------------------------------------
> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> > trial. Simplify your report design, integration and deployment - and focus on
> > what you do best, core application coding. Discover what's new with
> > Crystal Reports now. http://p.sf.net/sfu/bobj-july
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Py2exe-users mailing list
> > Py2exe-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/py2exe-users
>


Share your memories online with anyone you want anyone you want.