laptop and a wrench

Bug

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

Zuletzt veröffentlicht: October 28, 2015 ArcGIS for Desktop
Bug-ID-Nummer BUG-000091442
EingereichtOctober 15, 2015
Zuletzt geändertJune 5, 2024
Gilt fürArcGIS for Desktop
Gefunden in Version10.2.2
BetriebssystemWindows OS
Betriebssystemversion7.0 64 Bit
StatusKnown Limit

Zusätzliche Informationen

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.

Workaround

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

Schritte zur Reproduzierung

Bug-ID: BUG-000091442

Software:

  • ArcGIS for Desktop

Benachrichtigung erhalten, wenn sich der Status eines Bugs ändert

Esri Support App herunterladen

Weitere Informationen zu diesem Thema erkunden

Unterstützung durch ArcGIS-Experten anfordern

An den technischen Support wenden

Esri Support App herunterladen

Zu Download-Optionen wechseln