I am trying to copy an XY event layer, but I cannot get the copy feature working. Here is the error that I get:
Executing: Append1 D:\CAREX_3\Test\Abitibi_Pontiac_A D:\CAREX_3\Test\Abitibi_Pontiac_A\31m\Geochimie\Qc_31M01_GR.mdb\ECHANTILLON_LOCALISE_PT D:\CAREX_3\Test\Abitibi_Pontiac_A\31m\Geochimie\Qc_31M01_GR.mdb\ECHANTILLON_ROCHE D:\CAREX_3\Test\Abitibi_Pontiac_A\31m\Geochimie\Qc_31M01_GR.mdb\RESULTAT_ANALYSE Qc_31M01_GR
Start Time: Fri Jul 02 10:19:33 2010
Running script Append1...
Executing: CopyFeatures result D:\CAREX_3\Test\Abitibi_Pontiac_A\Qc_31M01_GR.shp # 0 0 0
Start Time: Fri Jul 02 10:19:34 2010
ERROR 999998: Unexpected Error.
Failed to execute (CopyFeatures).
End Time: Fri Jul 02 10:19:34 2010 (Elapsed Time: 0.00 seconds)
Completed script Append1...
Failed to execute (Append1).
End Time: Fri Jul 02 10:19:34 2010 (Elapsed Time: 1.00 seconds)
I have two tables (ECHANTILLON_ROCHE and RESULTAT_ANALYSE) and a feature class (ECHANTILLON_LOCALISE_PT) from a geodatabase to join together. Everything seems to work properly, except the last copy feature line.
Here is my script:
##################################################
#Join tables to a feature layer
#Steeve Deschenes
#Carex Canada
#June 2010
##################################################
# Import system modules
import sys, os, arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create()
# Local variables...
workfolder = sys.argv[1]
localise = sys.argv[2]
roche = sys.argv[3]
analyse = sys.argv[4]
database = sys.argv[5]
spref = r"Coordinate Systems\Projected Coordinate Systems\UTM\NAD 1983\NAD 1983 UTM Zone 17N.prj"
#Set workspace
gp.Workspace = workfolder
try:
gp.MakeFeatureLayer_management (localise, "local_lay")
gp.MakeTableView_management (roche, "r_lay")
gp.AddXY_management ("local_lay", "POINT_X", "POINT_Y")
gp.AddJoin_management ("local_lay", "PK", "r_lay", "FK", "KEEP_ALL")
gp.CopyFeatures_management ("local_lay", "temp_local")
gp.MakeFeatureLayer_management ("temp_local.shp", "local")
gp.MakeTableView_management (analyse, "a_lay")
gp.AddJoin_management ("a_lay", "FK", "local", "PK_1", "KEEP_ALL")
gp.MakeTableView_management ("a_lay", "temp_a_lay")
gp.MakeXYEventLayer_management ("temp_a_lay", "temp_local.POINT_X", "temp_local.POINT_Y", "result", spref)
#gp.SaveToLayerFile_management ("result", "temp_result")
#gp.FeatureClassToShapefile_conversion ("result", workfolder + "/" + database)
gp.CopyFeatures_management ("result", database)
gp.delete_management (workfolder + "temp_local.shp")
print gp.GetMessages
except:
gp.AddError (gp.GetMessages())
print gp.GetMessages
I have tried featureClassToShapefile and SaveToLayerFile as well without better results.
Thank you for your help