Get raster statistics arcpy syntax error

162
1
02-22-2012 02:06 PM
Highlighted
New Contributor III
I am new to arcpy and cannot figure out the following syntax error in python:


import arcpy
arcpy.env.workspace = �??Z:\Robins_Stuff\GIS_Data\Thiswontworkdata.gdb�?�
rasters = arcpy.ListRasters()
extension = "_contours"
for raster in rasters:
     r = arcpy.Raster(raster)
     r0 = r.mean
     r1 = r.standardDeviation
     r2 = r.mean + (r.standardDeviation * 1.65)
     r3 = r.mean + (r.standardDeviation * 2.33)
     r4 = r.mean + (r.standardDeviation * 3.10)
     arcpy.ContourList(r, str(r) + extension, [r2, r3, r4])

Parsing error <type 'exceptions.SyntaxError'>: invalid syntax (line 2)


I have tripled checked the pathname, and used "\" instead of "/"

Any help would be great!
Reply
0 Kudos
1 Reply
Highlighted
New Contributor
Hi,

   The quotation marks on your pathname are being read as special characters instead of " or '. Try writing your code with an interpreter such as IDLE (which is included with ArcGIS python install) or PythonWin.

Cheers,
Jody
Reply
0 Kudos