Python Training

Monday, 17 November, 2008

I’ve just returned from 2-days of of training in writing Python code at ESRI UK, reveling in the delights of Aylesbury. As I’ve mentioned in numerous posts, scripting is finally “back in” at ESRI and Python is the language of choice (although you can script with other languages). So much so that there is a training course on it. Don’t expect it to be an introduction to Python, although to Python is introduced. Rather it is an introduction to developing ArcGIS scripts with Python and how geoprocessing functionality is accessed. Our trainer, Rob McPherson, was excellent and very knowledgable having clearly done quite a bit of Python development. In order to get the most out of the course its worth having already used Python to do some scripting, but you don’t need to have done so.

Introductory material includes the geoprocessing environment, python, tools/environment settings and the programming model. These lay the ground for using and manipulating the functionality exposed through describe, enumeration and cursor objects. The course concludes with integrating scripts back in to ArcGIS and debugging.

Interestingly the course is delivered using PythonWin which isn’t shipped with ArcGIS (IDLE is the common IDE that accompanies Python). However it is easy to use, offers a reasonable attempt at highlighting text and offering object choices and provides a debugging environment. One of the main downsides is that you can’t kill (at least I don’t think so) a Python script that is running.

Which brings me on to the next point, namely that it seems far better to run all your own scripts from PythonWin (or IDLE) without starting up ArcGIS at all. It appears faster and more stable. In fact, avoid the IDE entirely and run it directly in Python by double-clicking on the .py file. Anyway, a good course that is well worth attending by anyone wanting to develop scripts or needing to build models. Apparently an “Advanced” course runs in the US, but is not currently available here. I hope ESRI UK can add this to their portfolio.

Add comment

Fill out the form below to add your own comments