CalculateField failing after upgrade to 10.1 and Win7 64bit

971
5
Jump to solution
01-08-2014 08:38 AM
FrankOgiamien
New Contributor II
Hi, I was previously using 10.0 on Win7 32-bit and have made the leap to 10.1 on Win7 64-bit.    For some reason a script that previously ran fine is now failing when it hits a CalculateField command.  The exact error message is:
"ERROR 000989:  Tool CalculateField cannot use VB expressions for services"

import arcpy # Local variables: Strata_TSA_VRI_bk = "E:\\Projects\\FMG_WTP_Overlays.gdb\\Strata_TSA_VRI_bk" Strata_TSA_VRI_bk_Layer = "Strata_TSA_VRI_bk_Layer" Strata_TSA_VRI_bk_Layer__3_ = "Strata_TSA_VRI_bk_Layer" # Process: Make Feature Layer arcpy.MakeFeatureLayer_management(Strata_TSA_VRI_bk, Strata_TSA_VRI_bk_Layer, "", "", "OBJECTID OBJECTID VISIBLE NONE;SHAPE SHAPE VISIBLE NONE;SISH_SEQ_NBR SISH_SEQ_NBR VISIBLE NONE;SISH_STRATUM_NAME SISH_STRATUM_NAME VISIBLE NONE;CROWN_CLOSURE CROWN_CLOSURE VISIBLE NONE;VRI_LIVE_STEMS_PER_HA VRI_LIVE_STEMS_PER_HA VISIBLE NONE;VRI_DEAD_STEMS_PER_HA VRI_DEAD_STEMS_PER_HA VISIBLE NONE;SPECIES_CD_1 SPECIES_CD_1 VISIBLE NONE;SPECIES_PCT_1 SPECIES_PCT_1 VISIBLE NONE;SPECIES_CD_2 SPECIES_CD_2 VISIBLE NONE;SPECIES_PCT_2 SPECIES_PCT_2 VISIBLE NONE;SPECIES_CD_3 SPECIES_CD_3 VISIBLE NONE;SPECIES_PCT_3 SPECIES_PCT_3 VISIBLE NONE;SPECIES_CD_4 SPECIES_CD_4 VISIBLE NONE;SPECIES_PCT_4 SPECIES_PCT_4 VISIBLE NONE;SPECIES_CD_5 SPECIES_CD_5 VISIBLE NONE;SPECIES_PCT_5 SPECIES_PCT_5 VISIBLE NONE;SPECIES_CD_6 SPECIES_CD_6 VISIBLE NONE;SPECIES_PCT_6 SPECIES_PCT_6 VISIBLE NONE;PROJ_AGE_1 PROJ_AGE_1 VISIBLE NONE;PROJ_HEIGHT_1 PROJ_HEIGHT_1 VISIBLE NONE;SHAPE_Length SHAPE_Length VISIBLE NONE;SHAPE_Area SHAPE_Area VISIBLE NONE") # Process: Select Layer By Attribute arcpy.SelectLayerByAttribute_management(Strata_TSA_VRI_bk_Layer, "NEW_SELECTION", "\"SPECIES_CD_1\" = 'FDI'") # Process: Calculate Field arcpy.CalculateField_management(Strata_TSA_VRI_bk_Layer__3_, "SPECIES_CD_1", "\"FD\"", "VB", "")


Traceback (most recent call last):
  File "E:\Projects\j4.py", line 22, in <module>
    arcpy.CalculateField_management(Strata_TSA_VRI_bk_Layer__3_, "SPECIES_CD_1", "\"FD\"", "VB", "")
  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 3129, in CalculateField
    raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000989: Tool CalculateField cannot use VB expressions for services
Failed to execute (CalculateField).

IDLE environment:  Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win32

Did I miss something during my installation of ArcGIS 10.1?   I have used VB syntax in all my scripts and I'd rather not change everything to Python syntax.

I have also tested this CalculateField command in ModelBuilder.   It executes sucessfully, just failing in the Python IDLE window.
Appreciate any suggestions.
Thanks,

Frank
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MichaelVolz
Esteemed Contributor
Unless you are running the python script with background processing (64-bit), python installed with ArcGIS v10.1 is only 32-bit.  You need to ensure you run this python script in 32-bit mode.

View solution in original post

0 Kudos
5 Replies
MichaelVolz
Esteemed Contributor
I don't think VB syntax is supported at v10.1.  I think you need to convert syntax to python.  There should be some Help on this in ESRI documentation and forums.
FrankOgiamien
New Contributor II
Do you mean it's not supported within Python?   Because in ArcGIS 10.1 if I bring up the Field Calculator there is a Parser box with a choice of VB Script and Python.
The Calculate Field tool in Model Builder also has a droplist for Expression Type and the default choice is VB, and it works fine.
I'd really hate to have to change all the CalculateField code in all my scripts...
It must be something related specifically to Python.

My version of ArcGIS says  10.1 SP1 for Desktop (Build 3143) if that helps.
0 Kudos
MichaelVolz
Esteemed Contributor
Unless you are running the python script with background processing (64-bit), python installed with ArcGIS v10.1 is only 32-bit.  You need to ensure you run this python script in 32-bit mode.
0 Kudos
FrankOgiamien
New Contributor II
I follow you now.  Even though I have the 64bit background processing available, when I run the CalculateField in Modelbuilder with the "VB" syntax, it knows to use the 32bit python.
I modified the CalculateField code to Python syntax and it ran successfully in Idle 64bit.  If I am too lazy to modify my code in other scripts, then I must use 32bit python.
Thanks very much,

Frank
0 Kudos
MichaelVolz
Esteemed Contributor
You summed it up better than my explanation.  I think that VB syntax is no longer valid in 64-bit mode, but you can still use it in 32-bit mode.
0 Kudos