I created a model in ModeBbuilder, and I exported the model as a script, but when I try to run it I get the following error. I have added my error below and the code below that. Thanks for any help.
Error: Traceback (most recent call last): File "C:\Temp\VirtualCampus\IGIS\IGISprogrammingscript_1.py", line 43, in arcpy.MakeFeatureLayer_management(Points_of_interest, Pointsofinterest_Layer, "", "", "FID FID VISIBLE NONE;Shape Shape VISIBLE NONE;CATEGORY CATEGORY VISIBLE NONE;NAME NAME VISIBLE NONE")
File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\management.py", line 5774, in MakeFeatureLayer raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000733: Output Layer: Same as input C:\Temp\VirtualCampus\IGIS\Super Output Areas.shp Failed to execute (MakeFeatureLayer).
Here is my code:
~# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# IGISprogrammingscript_1.py
# Created on: 2013-07-09 21:39:46.00000
# (generated by ArcGIS/ModelBuilder)
# Usage: IGISprogrammingscript_1 <Thames_shp> <Points_of_interest> <Super_Output_Areas_shp> <Thames_Buffer_shp> <superoutputareas_clip_shp>
# Description:
# ---------------------------------------------------------------------------
# Import arcpy module
import arcpy
# Script arguments
Thames_shp = arcpy.GetParameterAsText(0)
if Thames_shp == '#' or not Thames_shp:
Thames_shp = "C:\\Temp\\VirtualCampus\\IGIS\\Thames.shp" # provide a default value if unspecified
Points_of_interest = arcpy.GetParameterAsText(1)
if Points_of_interest == '#' or not Points_of_interest:
Points_of_interest = "Points of interest" # provide a default value if unspecified
Super_Output_Areas_shp = arcpy.GetParameterAsText(2)
if Super_Output_Areas_shp == '#' or not Super_Output_Areas_shp:
Super_Output_Areas_shp = "C:\\Temp\\VirtualCampus\\IGIS\\Super Output Areas.shp" # provide a default value if unspecified
Thames_Buffer_shp = arcpy.GetParameterAsText(3)
if Thames_Buffer_shp == '#' or not Thames_Buffer_shp:
Thames_Buffer_shp = "C:\\Temp\\VirtualCampus\\IGIS\\Thames_Buffer.shp" # provide a default value if unspecified
superoutputareas_clip_shp = arcpy.GetParameterAsText(4)
if superoutputareas_clip_shp == '#' or not superoutputareas_clip_shp:
superoutputareas_clip_shp = "C:\\Temp\\VirtualCampus\\IGIS\\superoutputareas_clip.shp" # provide a default value if unspecified
# Local variables:
Pointsofinterest_Layer__2_ = Thames_Buffer_shp
poi_cat = Pointsofinterest_Layer__2_
poi_cat_View = poi_cat
Pointsofinterest_Layer = Points_of_interest
pop = superoutputareas_clip_shp
pop_View = pop
# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(Points_of_interest, Pointsofinterest_Layer, "", "", "FID FID VISIBLE NONE;Shape Shape VISIBLE NONE;CATEGORY CATEGORY VISIBLE NONE;NAME NAME VISIBLE NONE")
# Process: Buffer
arcpy.Buffer_analysis(Thames_shp, Thames_Buffer_shp, "300 Meters", "FULL", "ROUND", "NONE", "")
# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(Pointsofinterest_Layer, "COMPLETELY_WITHIN", Thames_Buffer_shp, "", "NEW_SELECTION")
# Process: Summary Statistics
arcpy.Statistics_analysis(Pointsofinterest_Layer__2_, poi_cat, "CATEGORY COUNT", "CATEGORY")
# Process: Make Table View
arcpy.MakeTableView_management(poi_cat, poi_cat_View, "", "", "CATEGORY CATEGORY VISIBLE NONE;FREQUENCY FREQUENCY VISIBLE NONE;COUNT_CATEGORY COUNT_CATEGORY VISIBLE NONE")
# Process: Clip
arcpy.Clip_analysis(Super_Output_Areas_shp, Thames_Buffer_shp, superoutputareas_clip_shp, "")
# Process: Summary Statistics (2)
arcpy.Statistics_analysis(superoutputareas_clip_shp, pop, "LSOA_POP SUM", "")
# Process: Make Table View (2)
arcpy.MakeTableView_management(pop, pop_View, "", "", "Rowid Rowid VISIBLE NONE;FID FID VISIBLE NONE;FREQUENCY FREQUENCY VISIBLE NONE;SUM_LSOA_POP SUM_LSOA_POP VISIBLE NONE")~