Python and COM?

Karl Putland kperacles at geocities.com
Mon Jul 12 22:26:22 EDT 1999


Thanks for the info everyone.

I think that my first generation I might just release with some docs and examples.  Then work on the IDL.  I signed up on the pycom-dev list... I'd love to see this happen.  It's so much nicer in Python that C++ or VB for creating objects.  If anyone knows how far along Christian Tismer is with what he was working on, or what's left to be done, I'd like to help if I could.  I just don't know if I'm ready to play with the big dogs yet ;-)

Karl Putland
kperacles at geocities.com

P.S.
Start a big drive tomorrow. I'm moving back to Denver, CO, from AL, so I will be gone for a couple of weeks (switching providers, looking for broadband, etc...).  E-mail to my geocities address will still reach me when we get there.

Bye.


Bill Tutt <billtut at microsoft.com> wrote in message news:4D0A23B3F74DD111ACCD00805F31D8100DB90F0F at RED-MSG-50...
> 
> 
> > From: Mark Hammond [mailto:MHammond at skippinet.com.au]
> > 
> > 
> > Karl Putland wrote in message 
> > <7m9to7$6qg$82 at rks1.urz.tu-dresden.de>...
> > > For a COM server implemented in python, can a type library 
> > be generated?
> > 
> > No, but nearly :-)  Python has the framework and even some
> > "proof-of-concept" code, but isnt done.
> 
> Err.. Mark means from within Python. That's not to say you can't build a
> type library using an IDL file and MIDL.
> 
> Here's an example for the Python.Interperter COM server that exists in
> win32com\servers\interp.py.
> 
> Unfortuantely, Python.Interpreter needs a slight change inorder to write an
> IDL file.
> Replace the  _public_methods_ line with:
> _dispid_to_func = { 1 : Eval, 2 : Exec }
> A matching IDL that should work is attached below:
> (As an added bonus, this should actually work)
> The only GUID from interp.py is the coclass one. Every other GUID was just
> generated.
> Hope the below helps.... The MIDL docs in MSDN are certainly less than
> useful. :(
> 
> // System idl include nonsense
> import "oaidl.idl";
> import "ocidl.idl";
> 
> [
> uuid(EB048AA4-C2D1-11d2-855D-00C04F797DBA),
> helpstring("Python.Interepreter dispinterface")
> ]
> dispinterface IPythonInterpreter
> { properties: 
> methods:
> [id(1)] HRESULT Eval([in] BSTR bstrExpression, [out, retval] VARIANT
> pvarReturnValue);
> [id(2)] HRESULT Exec([in] BSTR bstrExpression);
> };
> 
> [
> uuid(60240FE4-C2D2-11d2-855D-00C04F797DBA),
> version(1.0),
> helpstring("Python.Interpreter Type Library")
> ]
> library PythonInterpreterLib
> {
> importlib("stdole32.tlb");
> importlib("stdole2.tlb");
> 
> [
> uuid(30BD3490-2632-11cf-AD5B-524153480001),
> helpstring("Python.Interpreter COClass")
> ]
> coclass PythonInterpreter
> {
> [default] dispinterface IPythonInterpreter;
> };
> 
> }
> 
> Bill





More information about the Python-list mailing list