laptop and a wrench

漏洞

The Calculate Field tool results in a NameError exception when using Python variables.

上次发布: October 28, 2015 ArcGIS for Desktop
漏洞 ID 编号 BUG-000091442
已提交October 15, 2015
上次修改时间June 5, 2024
适用范围ArcGIS for Desktop
找到的版本10.2.2
操作系统Windows OS
操作系统版本7.0 64 Bit
状态Known Limit

附加信息

Changes were made around 10.2.2 to properly isolate script tool code, validation and tool like Calculate Field and Calculate Value that use Python internally. Prior to this change, there was potential for confusing and unexpected issues that would be hard to isolate because a variable could be changed in one tool that would impact another tool. The best strategy for passing variables into CalculateField is using string formatting as shown in the workaround.

解决办法

Use the following code:arcpy.CalculateField_management(table,"gayu", "({0} + 1) / 2".format(funcg), "PYTHON", "")

重现步骤

漏洞 ID: BUG-000091442

软件:

  • ArcGIS for Desktop

当漏洞状态发生变化时获得通知

下载 Esri 支持应用程序

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

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项