gisrsbryce

Python script, SQL syntax within CalculateField question, missing quotes?

Discussion created by gisrsbryce on Dec 2, 2010
Latest reply on Dec 22, 2010 by hpbrantley
Here's my code, the problem is calling the string variable ScriptSub
I know this isn't complex but it's going to save me a ton of time if I can just get this right. 
I know that I'm probably just missing a double or single quote somewhere.  I really need this to work.  Thanks in advance. 

import sys
import string
import os
import arcgisscripting

gp = arcgisscripting.create(9.3)

# Set a default workspace
gp.workspace = "C:\working\Y2010\Franks\Plant"
# Set a toolbox
gp.toolbox = "management"

ScriptNm = sys.argv[0]
ScriptSub = os.path.basename(ScriptNm)

try:

    #Add fields
    gp.addfield ("\\FT_testing.gdb\FT_2010_P000\FT10_P180_Plant_test", "Depth_ft", "float", "5", "2")
    gp.addfield ("\\FT_testing.gdb\FT_2010_P000\FT10_P180_Plant_test", "Script", "text", "15")
      
except:
    # If an error occurs when running Addfield, print out the error message.
    print gp.GetMessages(2)

try:
    ############################
    # CALCULATIONS
    gp.CalculateField_management("\\FT_testing.gdb\FT_2010_P000\FT10_P180_Plant_test", "Depth_ft", "[ftbathy] * 3.2808 ", "VB")

    #This line is the problem                                                                   RIGHT HERE ???
    gp.CalculateField_management("\\FT_testing.gdb\FT_ 2010_P000\FT10_P180_Plant_test", "Script", 'ScriptSub', "VB", "")    

except:
    # If an error occurs when running Addfield, print out the error message.
    print gp.GetMessages(2)
try:

    print ScriptNm
    print ScriptSub

except:
    # If an error occurs when running Addfield, print out the error message.
    print gp.GetMessages(2)

Outcomes