Tool Calculate Field cannot use VB expression for service

1823
4
09-12-2016 03:05 AM
JustinGleeson1
New Contributor

Hi,

I have a model working in ArcGIS 10.3 that uses a .py script to run through a series of routines. One of them is Calculate Field and I have use Python_9.3 in the code. However, when I try and publish the service on my server I get an error: "Tool Calculate Field cannot use VB expression for service"

This is the code in the .py script. Any ideas where the problem is? I don't have VB anywhere.

arcpy.CalculateField_management("PopSummary", "PcPop014", '(!Sum_Pop_014T11! / !Sum_Pop_T11! )*100', "PYTHON_9.3")

Thanks

Justin

0 Kudos
4 Replies
FC_Basson
MVP Regular Contributor

Try wrapping your calculate expression in double quotes

0 Kudos
JustinGleeson1
New Contributor

HI FC,

I tried that. The model itself ran on ArcGIS but once I tried to publish the service the same error came up.

Code with double quotes below. Perhaps this is not what you meant?

arcpy.CalculateField_management("PopSummary", "PcPop65p", "'(!Sum_Pop_65pT11! / !Sum_Pop_T11! )*100'", "PYTHON_9.3")

Thanks

Justin

0 Kudos
FC_Basson
MVP Regular Contributor

Hi Justin, yes I meant replace the single quotes with double quotes.

0 Kudos
JustinGleeson1
New Contributor

FC, that worked out well for me

Thanks

0 Kudos