Thanks again.
I have another question: what do I need to change to build an out-of-process (.exe) server instead of a DLL?
ctype_com_server in setup.py has to change, but to what?
Also _reg_clsctx_ in MyTypeLib.py?

On Mon, May 25, 2009 at 2:43 PM, Thomas Heller <theller@ctypes.org> wrote:
H.R.Gartenbauer schrieb:
> I wrote a simple C++ test program, using MFC to wrap the typelib in the DLL,
> and successfully called the MyMethod function:
>
>   IMyInterface tester; // IMyInterface wrapper created by MFC class wizard
> from DLL
>   tester.CreateDispatch("MyTypeLib.MyObject");
>   long ret = tester.MyMethod(5,42);
>
> The corresponding python code, using the registered DLL, generates the
> access violation in the call to CreateObject:
>
> from comtypes.client import CreateObject
> x = CreateObject("MyTypelib.MyObject")
> print x.MyMethod(42, 5)

The problem is the unwanted interaction between the com object and the
com client in the one python interpreter they are using.

You could either use different Python versions for the client and the server,
or you use the '-b1' command line option for the py2exe build script, like this:
'python setup.py py2exe -b1'.

The '-b1' option creates a totally separated python interpreter.

Thomas


------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
_______________________________________________
Py2exe-users mailing list
Py2exe-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/py2exe-users