操作方法

错误:TypeError:CalculateGeometryAttributes 需要 0 到 5 个位置参数,但给出了 6 个

Last Published: February 6, 2025

描述

在 Python 脚本中运行计算几何属性工具时,可能会返回以下错误:

TypeError: CalculateGeometryAttributes() takes from 0 to 5 positional arguments but 6 were given.

原因

在 ArcGIS Pro 2.5 之前,计算几何属性工具仅接受 5 个参数:

in_features, geometry_property, {length_unit}, {area_unit}, {coordinate_system}

在 ArcGIS Pro 2.5 发布后,该工具现在接受 6 个参数:

in_features, geometry_property, {length_unit}, {area_unit}, {coordinate_system}, {coordinate_format}

运行以下代码行时,可以找出该工具接受的版本所用参数的数量:

arcpy.management.CalculateGeometryAttributes.__code__.co_argcount

解决方案或解决方法

升级到 ArcGIS Pro 2.5 或更高版本。

文章 ID: 000023718

获得人工智能支持

使用 Esri Support AI Chatbot 快速解决您的问题。

立即开始聊天

相关信息

发现关于本主题的更多内容

获取来自 ArcGIS 专家的帮助

联系技术支持部门

立即开始聊天

转至下载选项