AnsweredAssumed Answered

Export model to Python and local variables are still hard-coded

Question asked by blake.terhune on Aug 26, 2014
Latest reply on Aug 26, 2014 by iamurray

Is there a way to export a model to a Python script and avoid the local variable paths from being hard-coded? In the sample code below, you can see the export took the effort to make the beginning parameters into variables but the rest of the script still has the same path hard-coded. What's up with that?

 

# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# deletethis.py
# Created on: 2014-08-26 11:36:22.00000
#   (generated by ArcGIS/ModelBuilder)
# Description: 
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy

# Local variables:
TEMP_Point = "N:\\TechTemp\\BlakeT\\Work\\TEMP.gdb\\TEMP_Point"
TEMP_gdb = "N:\\TechTemp\\BlakeT\\Work\\TEMP.gdb"

# Process: Table to Table
arcpy.TableToTable_conversion(TEMP_Point, TEMP_gdb, "TEMP_Pont_Output", "", "Note1 \"Note1\" true true false 50 Text 0 0 ,First,#,N:\\TechTemp\\BlakeT\\Work\\TEMP.gdb\\TEMP_Point,Note1,-1,-1;Note2 \"Note2\" true true false 50 Text 0 0 ,First,#,N:\\TechTemp\\BlakeT\\Work\\TEMP.gdb\\TEMP_Point,Note2,-1,-1", "")

Outcomes