Select to view content in your preferred language

MakeXYEventLayer from python addin dataset does not exist

3423
4
12-07-2015 08:52 AM
BenjaminSimpson
Deactivated User

Hi,

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)
     else:
          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.

Ben.

0 Kudos
4 Replies
FreddieGibson
Honored Contributor

Is your python addin calling the above script? Can you show have you're calculating the path to the geodatabase? Are you just pointing to a known location or did you include the data within the addin structure?

0 Kudos
IanMurray
Honored Contributor

Could it be because of the parentheses that are in the file path to the table?

0 Kudos
BenjaminSimpson
Deactivated User

Yes, my python addin is calling my custom toolbox which contains this script. Its being called from a toolbar button. The input for the tool is the SAGIS_model_new variable which allows the user to select the geodatabase. This is providing a list of selected geodatabase paths which the script is working from. This script will eventually run these processes and more on multiple geodatabases. The other arc tools which I have used in my full script have run correctly (e.g. AddGeometryAttributes, CreateTable and CreateFeatureclass).

Does that answer your question?

0 Kudos
JamesCrandall
MVP Frequent Contributor

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

Probably because you are using Personal Geodatabase and things are executing in 64-bit processes (just a guess).

I'd recommend you move everything into a File Geodatabase and then run your script and see if it works.  Other than that, you'll likely need to explicitly set your script to run 32-bit because, well... that's MS Access (.mdb).

0 Kudos