[python-win32] RE: Python-win32 Digest, Vol 2, Issue 19

Andrew MacIntyre Andrew.MacIntyre at aba.gov.au
Fri May 23 13:28:46 EDT 2003


> From: Craig Taverner
> Sent: Friday, 23 May 2003 3:34 AM
>
> 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.

Always good to have company!  Thanks for taking the time to reply.

> 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). 

Excellent!!

> 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.

:-(  I had inferred that Pythoncom's early binding would be sufficient 
to deal with the documented IDispatch restriction, but Bill's comments 
would seem to make that unlikely...

I came across 1 reference to vtables (C++) based interfaces in the 
Pythoncom help file, albeit in relation to COM servers, which gives 
me faint hope this is still feasible.  Lots of reading & code inspection 
still to do...

> 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.

While comfortable with C, C++ is something I've never gotten into.  I 
was hoping I could use Python instead of VB for my Arc based app.

> 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 ;-)

I've been using Python and Arc/Info (the workstation version) for a 
few years, and have picked up some ArcObjects familiarity through 
MXD document macros in VBA, so my learning curve isn't quite as steep
...
 
> 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?

Good idea.

> 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.

Sorry :-(  I have little experience with threading full stop.

Regards,
Andrew.

-----------------------------------------------------------------------
Andrew MacIntyre                  \ E-mail: andrew.macintyre at aba.gov.au
Planning & Licensing Branch        \ Tel:   +61 2 6256 2812
Australian Broadcasting Authority   \ Fax:  +61 2 6253 3277
-> "These thoughts are mine alone!" <----------------------------------



More information about the Python-win32 mailing list