Good day,
What should I do to avoid this error
Traceback (most recent call last):
File "G:\MB\script\Model3C.py", line 37, in <module>
arcpy.Select_analysis(Input_Features, Output_Feature_Class, Expression)
File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\analysis.py", line 84, in Select
raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000670: output Output Feature Class is same as input Input Features
Failed to execute (Select).
-------------------------------------------------------------------------------------------------------------------------------------------------------
This is my code:
# Import arcpy module
import arcpy
# Load required toolboxes
#arcpy.ImportToolbox("Model Functions")
# Script arguments
Input_Features = arcpy.GetParameterAsText(0)
Expression = arcpy.GetParameterAsText(1)
Group_By_Fields = arcpy.GetParameterAsText(2)
NOMBRE__Value_ = arcpy.GetParameterAsText(3)
if NOMBRE__Value_ == '#' or not NOMBRE__Value_:
NOMBRE__Value_ = "C:\\Users\\CARLOSH\\Documents\\ArcGIS\\Default.gdb\\NOMBRE_CONSTANTE_%Value%" # provide a default value if unspecified
Skip_Null_Values = arcpy.GetParameterAsText(4)
if Skip_Null_Values == '#' or not Skip_Null_Values:
Skip_Null_Values = "false" # provide a default value if unspecified
# Local variables:
Output_Feature_Class = Input_Features
Selected_Features = Output_Feature_Class
Value = Output_Feature_Class
# Process: Select
arcpy.Select_analysis(Input_Features, Output_Feature_Class, Expression)
# Process: Iterate Feature Selection
arcpy.IterateFeatureSelection_mb(Output_Feature_Class, Group_By_Fields, Skip_Null_Values)
# Process: Copy Features
arcpy.CopyFeatures_management(Selected_Features, NOMBRE__Value_, "", "0", "0", "0")
can you throw some print statements in so the various inputs and outputs can be evaluated
Thank you for answering ,
this code is good! When you step to a tool it generates the error that I showed, I attached a screen with parameters and output interface and error running.
Este codigo genera un featureclass por registro .
I have no experience in python, I have problems with parameters, which is not the error generating tool.
It would be useful to show what you selected when the tool was being run. In place of print statements you need to use arcpy.AddMessage( stuff ) to get print-out to the dialog when it is running. As it stands, it is difficult to determine whether the parameters are correct since you haven't listed them
What are you trying to accomplish? I see in your code that you are setting the output feature class name to the name of your input feature class, hence the error message. Are you trying to overwrite an existing feature class with a subselection of itself?