Using the Make XY Event Layer tool I converted a table to a layer.

I am trying to convert the newly created layer to a feature class in my file geodatabase.

I have been able to do this in ModelBuilder but when I exported the model to a script and ran that it failed to complete - see Export as Python script from ModelBuilder never completes?.

When run from its tool dialog it makes no progress and does not give an error (while in ModelBuilder it takes about 7.5 seconds for it to run).

I tried to convert the layer to a shapefile with ConversionTools>ToShapefile and get the same result.

Finally I right clicked the layer I created with MakeXYEventLayer and performed Date>ExportData>Exported it to my file geodatabase and it worked.

How do I get this to work via the tool dialog (so that it will then work in the Python script)?

  • Interesting, for a start you can skip ', "", "0", "0", "0"' in copyfeatures, if they're not populated just leave them out, if that doesn't work you could create the feature class manually and Append the events or Select, or Feature class to shapefile.. there's a few ways. Did you get an error message? Mar 4, 2015 at 23:13
  • I removed the ', "", "0", "0", "0"' and get the same results I'm looking for a solution that allows me to automate this work flow.
    – risail
    Mar 4, 2015 at 23:18
  • There are a few options to go from a layer to a feature class, for this one wells has no extension, you could try putting '.shp' on the end of it.. but it would help if there was an error message to see why it's failing, in these cases the problem is most likely in the CSV and not the tool.. Try FeatureClassToShapefile resources.arcgis.com/en/help/main/10.2/index.html#/… or Select resources.arcgis.com/en/help/main/10.2/index.html#//… with no query. Mar 4, 2015 at 23:22
  • This looks like a duplicate of gis.stackexchange.com/questions/137712/… - I think for this not to be a duplicate it needs to be edited to focus on just running the two steps from their tool dialogs as suggested (perhaps not clearly enough) in a comment on its earlier incarnation.
    – PolyGeo
    Mar 4, 2015 at 23:26
  • 1
    @MichaelMiles-Stimson I've edited the question to try and separate the problem of the tool not completing from its dialog from the tool not completing from within a script. The former will be what causes the latter so I'm trying to help the asker by teasing the source of the problem out from where its manifestation was first observed. I'm not sure if you were aware of the earlier Q&A.
    – PolyGeo
    Mar 4, 2015 at 23:43

1 Answer 1


There has to be a problem with the CSV file.

Possibilities include (but are not limited to):

  • Spaces and/or non-alphanumeric characters in field names, or starting with underscore.
  • Bad data in cells. Esri only reads the first few lines to decide the data type, if the first dozen or so are numbers it calls the field integer, if there's later a value like 'N/A' in the field then it has a spit!
  • Duplicated field names, when shortened to 10 characters.
  • 'reserved' field names: FID, SHAPE etc..
  • Permission denied by OS

I have tested this on a table:


with the code:

import arcpy
outShp = r'D:\some\path\test'

and it works just fine. Have a closer look at your tabular data, there's bound to be a problem there. I did notice on your previous post:

arcpy.MakeXYEventLayer_management(Wells_csv, "Surface_Longitude", "Surface_Longitude", Wells_Layer,

has "Surface_Longitude" for X and Y - this doesn't affect the tool too much but you'll end up with all your features on a 45degree slope with the same X and Y.

  • I thought the same thing except it creates a layer and works in model builder and it works with right clicking export...the csv is good
    – risail
    Mar 5, 2015 at 1:08
  • you're absolutely sure of that? There's nothing that's been 'fixed' in the layers by those other tools that you haven't checked? You've also changed the duplication of the X field? I feel that there are some field names that, when shortened to the max length of the shape file fields, are identical. What field names do you have in the CSV? Mar 5, 2015 at 1:14
  • Yes..My headers are API,Well_Name,Well_Suf,Op_Num,Btm_Fld,Spd_Dt,Btm_Ls_Num,RKB_Elv,BH_Total,Tr_Vrt_Dp,Srf_N_S_Ds,Srf_N_S_Cd,Srf_E_W_Ds,Srf_E_W_Cd,Srf_Area,Srf_Blk,Btm_N_S_Ds,Btm_N_S_Cd,Btm_E_W_Ds,Bt_E_W_Cd,Btm_Area,Btm_Blk,Ttl_Dp_Dt,St_Dt,Type_Code,Distr_Code,Stat_Code,Wtr_Dpth,Surf_Lon,Surf_Lat,Btm_Lon,Btm_Lat,Surf_Lse,Cmplx_ID,Strut_Num
    – risail
    Mar 5, 2015 at 14:45
  • Where's surface_lonitude (and presumably surface_latitude)? It seems to me that your fields don't exist hence your error. In this table it's surf_Lat and surf_Lon. Mar 5, 2015 at 21:30
  • Surf_Lon,Surf_Lat I modified it slightly. I spoke with ESRI tech support and they had me disable the Background Processing under Geoprocessing Options and it now works manually but they are still unsure why the script is not working (yes, I tried copying the python snippets), the problem is not in the CSV
    – risail
    Mar 5, 2015 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.