在arcpy中判断要素类型,但脚本文件运行desc.shapeType出现属性错误?

使用arcpy中的Describe获取要素类元信息代码如下:
import arcpy
featureClass = r"I:\DATA\Vector Data\AUS_adm_shp\AUS_adm1.shp"
desc = arcpy.Describe(featureClass)
print "shapeType", desc.shapeType
print "extent XMin", desc.extent.XMin
print "extent XMax", desc.extent.XMax
print "the first field's name", desc.fields[0].name
print "the first field's name", desc.fields[1].name

但是在脚本中运行会出现属性错误,表示没有shapeType属性
shapeType
Traceback (most recent call last):
File "tmp.py", line 4, in <module>
print "shapeType", desc.shapeType
AttributeError: DescribeData: Method shapeType does not exist
但是在命令行中单独运行可以得到正确结果。
 
已邀请:

pai

赞同来自:

请问楼主问题解决了吗?我在arcgis10.2版本可以运行以上代码,但是在10.4.1版本上会提示没有shapeType属性。

要回复问题请先登录注册