AnsweredAssumed Answered

Arcpy Inline variables

Question asked by rarchibald on Oct 22, 2014
Latest reply on Oct 22, 2014 by curtvprice

I don't use python that often, so hopefully this hasn't been asked 100 times already.


I have a python script created that already contains variables for two tables in a database.  The current python below works fine, but I want to get rid of the paths that are in bold below and replace them with variables.  I have tried deleting the paths and replacing them with the existing variables, but it doesn't appear to work.  I get the correct number of rows added to the second table, but all of the attributes are NULL.  This seems like it should be fairly straight forward, but everything I have tried seems to result in the empty output.  I have tried several options like converting the parameters to strings use the ("%s%s") method but get the same null values.  The only thing that seems to be working is including the full paths.


# Import arcpy module
import arcpy

# Local variables:
Path = "C:\\Users\\Username\\Documents\\ArcGIS\\Default.gdb"
SourceTable = Path + "\\SourceTable"
TargetTable = Path + "\\TargetTable"

# Process: Append
arcpy.Append_management(SourceTable, TargetTable, "NO_TEST", (
 "Parcel_ID \"Parcel_ID\" true true false 50 Text 0 0 ,First,#,C:\\Users\\Username\\Documents\\ArcGIS\\Default.gdb\\SourceTable,Parcel_ID,-1,-1;"
 "RoadType \"RoadType\" true true false 50 Text 0 0 ,First,#,C:\\Users\\Username\\Documents\\ArcGIS\\Default.gdb\\SourceTable,RoadType,-1,-1", "")

print "Process Finished"


CP modified code formatting