#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的函数之后就不报错了。

相关文章:

  • 2021-11-23
  • 2021-04-22
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2021-09-30
  • 2022-01-18
猜你喜欢
  • 2021-04-13
  • 2022-03-04
  • 2021-12-12
  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2021-05-01
相关资源
相似解决方案