Podcasts and Python

August 13, 2007

I’ve been listening recently to “.NET Rocks!” twice weekly .NET development podcasts. It is very easy to listen to, mainly due to the personalities of the presenters, and it gives a good overview of .NET develpment and related technologies. Software development as a whole is often discussed – test driven development, agile programming, management, spaghetti code…

A full archive of previous episodes is available for download (for free), and I found an epsiode that gives a good introduction to Python – it can be downloaded here. I’m still not convinced of the use of Python and ArcObjects as explaining how to run scripts with parameters to GIS users, or creating custom toolboxes, takes as much time as creating a nice UI in Visual Studio. In the show one of the presenters asks “but don’t you miss the Visual Studio environment and intellisense?”, which I couldn’t agree more with. However there is also mention of IronPython, which I knew had something to do with .NET, but it can also apparently be used within the Visual Studio environment which could make life a whole lot easier.

I’m off to download IronPython now…



Starting With Python

July 9, 2007

I have been writing a few geoprocessing scripts with Python recently, and have now even started to write scripts with more than one function..

I know I should sit down and read all the basics of a language first before using it, but where is the fun in that? I had written my main script, which called a couple of functions declared in the same .py file. I kept running into the following error:

“NameError: name ‘getMyFileTimes’ is not defined”

After looking a few times at how to declare functions, I realised eventually that they have to be declared before calling them. E.g.

def hello (what):
     text = “Hello, ” + what + “!”
     print text
hello (“World”)

I guess I am still getting used to writing in a scripting language in what amounts to little more than notepad, and it makes sense that if it is not compiled and read line by line then the function would not be “seen.” Still I miss my autosensing, and Visual Studio debugging tools a lot…