Module 05 - Debugging and Troubleshooting Python Scripts
Summary:
I found this
week’s assignment to have a lot of relevance in the “real world”. The majority of the code you write will not
work properly the first time you run it.
This is where your ability to debug and correct the course of the
program is your most valuable asset.
This week we
learned several valuable skills towards that goal:
·
Benefits
of using IDLE or PythonWin in different situations to improve debugging.
·
Identifying
some of the most common errors and how to troubleshoot them.
·
The
importance of indentation (and the difficulty in tracking down bugs related to
indentation)
·
How
to use the Alt-G command to jump to a specific line number to debug (very
useful!!!)
·
How
to use PDB to see behind the scenes.
·
How
to use breakpoints and watches to better understand what is going on in your
program.
·
How
to understand the error messages that ArcGIS will display.
·
The
use of some arcpy funtions like GetMessageCount() and GetMessages()
·
How
to use Python to Programmatically buffer a point using the Geoprocessing tools.
I think you
could attend an entire semester on this phase of the programming process and
still not know all there is to know. I
have found that the ability to debug code is one of the most important skills
you have as a programming professional.
It gets even more difficult when you have to debug code that someone
else wrote.
I picked up
a couple of good books that might help the people in this class learn a bit
more about ModelBuilder and Python.
They are :
Getting to Know ArcGIS ModelBuilder –
by David W. Allen ISBN-10: 1589482557
And
A Python Primer for ArcGIS by Nathan Jennings - ISBN-10: 146627459X
In
particular, I really like the David W. Allen Book.
No comments:
Post a Comment