AnsweredAssumed Answered

MakeXYEventLayer from python addin dataset does not exist

Question asked by simpson.ben1990 on Dec 7, 2015
Latest reply on Dec 7, 2015 by jamesfreddyc



I have a python addin which is running a custom toolbox. Part of the python script linked to the toolbox is suppose to use the arcpy.MakeXYEventLayer_management tool to create a point feature class from a table in my personal geodatabase. The problem I am having is that it keeps coming up with the error saying that the dataset does not exist or is not supported (below). When I do the same process manually it works fine and the MakeXYEventLayer tool creates the point feature class. I am not sure why it is unable to detect the database table.


ERROR 000732: XY Table: Dataset D:\SAGIS Conversion\SAGIS Models Test\Model_2_Wick River_T1 - Copy (17)\SAGIS_Wick_River_2.mdb\SimWaterBodiesT1 does not exist or is not supported

Failed to execute (MakeXYEventLayer).


Here is a snippet of my code:


import arcpy
import os
import sys

SAGIS_model_new = [arcpy.GetParameterAsText(0)]
model_pos = 0
for model in SAGIS_model_new:
     featureList = arcpy.ListFeatureClasses()
     if "SimWaterBodiesCent" in featureList:
          arcpy.AddMessage("SimWaterBodiesCent feature class already exists within " + Model_Name)
          SimWaterBodies = os.path.join(SAGIS_model_new[model_pos], "SimWaterBodies")
          SimWaterBodiesT1 = os.path.join(SAGIS_model_new[model_pos], "SimWaterBodiesT1")
          x_coords = "CentroidX"
          y_coords = "CentroidY"
          out_Layer = "SimWaterBodiesCent"
          spatial_reference = arcpy.Describe(SimWaterBodies).spatialReference

          arcpy.MakeXYEventLayer_management(SimWaterBodiesT1, x_coords, y_coords, out_Layer, spatial_reference, "")
          arcpy.FeatureClassToFeatureClass_conversion(out_Layer, simcat, "SimWaterBodiesCent")

          model_pos = model_pos +1


Can someone help me work out why this error message is persisting:


Thanks in advance for any help.