I'm running into an issue when packaging up a python script. In the script it adds a field and then calculates the field like this:
# Calculate Fields
arcpy.CalculateField_management(SelectedStrategy_Loss, "Before_nLoss", "[urineNLeached]", "VB", "")
This all works fine when I run it in ArcGIS Desktop as a tool, however after I package up this process, I notice the following is done at the top of my script:
# Esri start of added variables
import os, arcpy
g_ESRI_variable_1 = os.path.join(arcpy.env.packageWorkspace,u'data.gdb\\Strategies\\Strategies_Polygon')
g_ESRI_variable_2 = os.path.join(arcpy.env.packageWorkspace,u'data.gdb\\Strategies\\Strategies_Line')
g_ESRI_variable_3 = os.path.join(arcpy.env.packageWorkspace,u'data.gdb\\Strategies\\Strategies_Point')
g_ESRI_variable_4 = os.path.join(arcpy.env.packageWorkspace,u'data.gdb\\Nitrogen')
g_ESRI_variable_5 = u'%scratchGDB%\\SelectedStrategy'
g_ESRI_variable_6 = u'%scratchGDB%\\SelectedStrategyLoss'
g_ESRI_variable_7 = u'Before_nLoss'
g_ESRI_variable_8 = u'"urineNLeached"'
g_ESRI_variable_9 = u'After_nLoss'
g_ESRI_variable_10 = u'"Before_nLoss" * 0.91'
# Esri end of added variables
So, the packaging process seems to be converting the square brackets to quotation marks - u'"urineNLeached"'. When I change this to u'[urineNLeached]', it workd fine.
Just wondering if this is a bug and if it what the workaround would be?