Errata - Programming ArcGIS 10.1 With Python Cookbook
Errata - Programming ArcGIS 10.1 With Python Cookbook
Chapter 3
Page 55
Step 6:
Page 55
Step 8:
The print statement should be indented inside the for loop as seen below:
print layer.name
Page 57
Step 8:
Make sure the line that creates the layers variable and the next line that creates the for loop are
indented the same. It should appear as seen below.
Chapter 4
Page 80
Step 5:
Page 83
Step 4:
Page 97
Step 5:
Page 104
Step 8:
Should be:
mapping.ExportToPDF(mxd, rc:\ArcpyBook\Ch5\Map_DataFrameCrime.pdf, df)
Page 106
Step 7:
Should be:
mapping.ExportToJPEG(mxd, rc:\ArcpyBook\Ch5\DataFrameCrime2.jpg, df, world_file=True)
Page 107
Step 5:
Should be:
pdfDoc.appendPages(rc:\ArcpyBook\Ch5\DataFrameCrime.pdf)
Chapter 6
Page 123
Step 4:
Needs to include quotes around Streams_Buff and leave off the last double quote around Feet. So it
should be:
arcpy.Buffer_analysis(Streams.shp, Streams_Buff, 200 Feet)
Chapter 7
Page 129
Step 8:
Should be:
arcpy.CreateFeatureclass_management(os.path.split(outputFC)[0], os.path.split(outputFC)[1], point,
fClassTemplate)
Chapter 9
Pages 177, 178
Step 13 and 18
Should be:
with arcpy.da.InsertCursor
Instead of
with da.InsertCursor
Page 188-189
Step 8
Should be:
edit = arcpy.da.Editor(rc:\ArcpyBook\data\CityOfSanAntonio.gdb)
Page 191
Step 4:
Should be:
infc = c:/ArcpyBook/data/CityOfSanAntonio.gdb/SchoolDistricts
Chapter 10
Page 199
Step 7:
Should be:
except Exception as e:
Page 205
Step 9:
Should be:
exception Exception as e:
Page 207
Step 5:
Should be:
descWorkspace = arcpy.Describe(c:/ArcpyBook/data/CityOfSanAntonio.gdb)
Page 207
Step 8:
Should be:
exception Exception as e:
Chapter 11
Page 222
Step 17:
Should be:
def onClick(self)
arcpy.ImportToolbox(c:/ArcpyBook/Ch7/WildfireTools.tbx)
arcpy.LoadWildfires_wildfire()
Note: This can only be called if you completed Chapter 7 which had you create a script tool called
LoadWildfires. If you named the script tool something else youll need to update this code to whatever
you called the script tool. If you didnt complete the Chapter 7 exercise then you wont be able to test
this particular add-in. Thats ok though just find another script tool in ArcToolbox that you can execute
and use that instead. Just continue through the step so that you understand how to create the add-in.
Page 231
Step 12:
if arcpy.Exists(randompts.shp)
Arcpy.Delete_management(randompts.shp)
arcpy.RefreshActiveView
return randompts
Chapter 12
Page 242
Step 5:
errCode = arcpy.GetReturnCode(3)
if str(errCode) in 735:
Appendix B
Page 271
Step 4: