This code works in the arcgis python window but in PyScripter, this warning message had been written:
Traceback (most recent call last): File "", line 16, in
File "C:\Program Files
(x86)\ArcGIS\Desktop10.2\arcpy\arcpy_init_.py", line 1167, in
SearchCursor return gp.searchCursor(dataset, where_clause,
spatial_reference, fields, sort_fields) File "C:\Program Files
(x86)\ArcGIS\Desktop10.2\arcpy\arcpy\geoprocessing_base.py", line 359,
in searchCursor self._gp.SearchCursor(*gp_fixargs(args, True)))
IOError:
import arcpy
arcpy.env.workspace = r"C:\Desktop\spatial statistics analysis tutorials\PatternAnalysis\PatternAnalysisExercise\DengueData.gdb"
# place all the rows from the feature class into a search cursor
cursor = arcpy.SearchCursor("IndCases")
# iterate through the cursor and print the attributes to the interactive window
# print it in a standard three line format
for row in cur:
print row.AGE
I was wondering why this situation happened, any suggestions?
Best Answer
It could be an issue with the workspace path. if this is a win7 machine, i would not typically expect to see a path like
Instead, i would expect a path like
in a quick test, i found that arcpy will happily set the workspace to a non-existent path- only to later fail because it can't find the feature class.