我有这些代码行:
import tkFileDialog, arcpy, arcpy.da, numpy as np, Tkinter
import arcpy.mapping as mapping
fc = tkFileDialog.askopenfilename(filetypes=[('shapefiles','*.shp')],title='Choose a Shapefile')
print 'fc = {0}'.format(fc)
desc = arcpy.Describe(fc)
#Find the number of rows(alternatives) and print it!
number_of_rows = arcpy.GetCount_management(fc)
R = int(number_of_rows.getOutput(0))
print R
#Find the number of columns(criterias) and print it!
C = len(arcpy.ListFields(fc))
print C
它创建了一个GUI,我可以浏览和打开shapefile 此shapefile是一个带有图层和属性表的ArcMap shapefile 使用此算法,我收到此错误:
ExecuteError:ERROR 000229:无法打开 C:/Users/Th/Desktop/waterways.shp
执行失败(GetCount)。
我该如何解决这个问题? 在不使用GUI的情况下,我手动将shapefile添加到算法中:
fc = "C:/Users/Th/Desktop/waterways.shp"