[python-win32] RE: Python-win32 Digest, Vol 2, Issue 19
Craig Taverner
craig.taverner at comopt.com
Thu May 22 20:33:35 EDT 2003
Hi Andrew,
I'm sorry I don't have a good answer for you, but I'm replying anyway
because I'm also trying to use pythoncom to access the ESRI ArcObject
libraries. I was fortunate enough to have a chance to discuss python
access to ArcObjects with one of their key developers, Bill Moreland,
who has been involved in building the next vrsion of Model Builder for
ArcGIS 9.0, and they've decided to make Python the primary scripting
language to replace avenue (ModulBuilder will export to python, vbscript
and jscript, but they are viewing python as the best choice). He told me
how because python can only access IDispatch interfaces (unless the
pythoncom has native support for the interfaces, which it does not for
ArcObjects), a large part of ArcObjects is not available to python
normally. They have written a generic interface system of some kind to
allow python, vbscript and jscript to access all these additional COM
classes anyway, but with low performance. This is not really available
to us except with ArcGIS 9.0, and I think also only for ModelBuilder for
scripting geoprocessing.
Personally I'm curious to know how difficult it would be to make the
ESRI library a natively supported COM library for python. Perhaps it is
just a matter of writing a wrapper C++ library that can plug into
python. I'm a complete newbie to python myself, and have only chosen it
because of the 'advocacy', so I do not know how to do this, or if it
would be a trivial thing (eg. Have a script that reads the esriCore.olb
file and auto-generates the C++ wrappers for us), or if it's tons of
difficult coding.
I've any of the pythonwin masters have an answer here, that would be
great!
I'm just getting into this, learning COM, learning ArcObjects and
learning python. A triple steep learning curve ;-)
Since you are working with python access to ArcObjects, and I'm trying
to get into that, I think it would be nice if we kept in touch, and so
we could help each other out with technical issues?
Right now I'm writing a python COM server to be called from a VB
application that has embedded esriCore.MapControl. The only problems I'm
having so far as that the python COM server needs to be multithreaded
because the VB thread cannot be blocked by long calculations, and I'm
having a little trouble figuring out all the subtleties of
COM/threading. If you have experience here, that would be great.
Cheers, Craig
> I'm working with a package (ESRI ArcGIS) that supports a number of
> ActiveX controls. Various methods of the generated interface classes
> are noted in comments to return references to objects not defined
> in the control type library, but which are defined in one of several
> "support" type libraries.
>
> Looking at the makepy generated files for the support libraries, I
> find that many interfaces don't have class definitions, but do have
>
> <interface>_vtables_dispatch_ = ?
> <interface>_vtables_ = [ <list of member tuples> ]
>
> sections, where the "?" is usually either 0 or 1. Other interfaces
> have both the class definition and the "_vtables..." definitions.
>
> What is the significance of this? How can I access the members of
> an interface which has no class definition?
>
> After coming across a reference by MarkH to CastTo() in the list
> archives, and not finding any docs, I perused the source.
>
> Unfortunately, the current version's comments note that support for
> interfaces in other type libraries doesn't yet exist :-(.
>
> If its not obvious, I'm new to COM programming in general, and
> Pythonwin (but not Python) in particular. If anyone has some
> recommendations for books or online resources, especially
> non-trivial application sources that I can look over for
> enlightment, that would be most appreciated.
More information about the Python-win32
mailing list