#coding:utf8 import arcpy path=r'D:\work\data\temp\test.shp' with arcpy.da.SearchCursor(path,'FID') as rows: print rows
上述代码报错:
Traceback (most recent call last):
File "D:/temp/test.py", line 11, in <module>
with arcpy.da.SearchCursor(path,'FID') as rows:
RuntimeError: cannot open 'D:\work\data\temp\test.shp'
没找到原因,但是在这句之前如果设置了arcpy.env.workspace 或者执行了与文件路径相关的arcpy的函数之后就不报错了。