<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Make XY Event Layer  in Python Crashes But Not in Model Builder in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574119#M44985</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;It's a direct export from the model built.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That's probably one of your problems. I'd first clean up your code so it is legible.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also don't see any reference to the path from your error C:\Spatial.mdb\WELLS.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Jan 2013 19:50:24 GMT</pubDate>
    <dc:creator>MathewCoyle</dc:creator>
    <dc:date>2013-01-21T19:50:24Z</dc:date>
    <item>
      <title>Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574116#M44982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to automate a table (in geodatabase) with lat longs and convert it into a feature class. I first created the steps in model builder where it works fine. But when I export out into Python script and run it without any modifications to the script, it would fail and give me the error below.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000732: XY Table: Dataset C:\Spatial.mdb\WELLS does not exist or is not supported&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (MakeXYEventLayer)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am running Win 7 64 bit 10.1 SP1 with Geoprocessing for SP1 updated as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]20937[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 19:02:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574116#M44982</guid>
      <dc:creator>AdamGuo</dc:creator>
      <dc:date>2013-01-21T19:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574117#M44983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Posting the code that prompted the crash would be helpful.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 19:21:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574117#M44983</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-01-21T19:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574118#M44984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry, here's the code. It's a direct export from the model built.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# a.py
# Created on: 2013-01-21 15:09:24.00000
#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)
# Description: 
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy


# Local variables:
WELLS__2_ = "C:\\FoB Oil and Gas\\GoM\\GOM_Spatial.mdb\\WELLS"
WELLS__3_ = "C:\\FoB Oil and Gas\\GoM\\GOM_Spatial.mdb\\WELLS"
WELLS__4_ = "C:\\FoB Oil and Gas\\GoM\\3_Compare\\Compare.mdb\\WELLS"
WELLS_Layer = "WELLS_Layer"

# Process: Make XY Event Layer
arcpy.MakeXYEventLayer_management(WELLS__4_, "SURFACE_LONGITUDE", "SURFACE_LATITUDE", WELLS_Layer, "GEOGCS['GCS_North_American_1927',DATUM['D_North_American_1927',SPHEROID['Clarke_1866',6378206.4,294.9786982]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98305509728916E-09;0.001;0.001;IsHighPrecision", "")

# Process: Feature Class to Feature Class
arcpy.FeatureClassToFeatureClass_conversion(WELLS_Layer, WELLS__3_, "Wells_Spatial", "", "API \"API\" true true false 12 Text 0 0 ,First,#,,API,-1,-1;WELL_NAME \"WELL_NAME\" true true false 255 Text 0 0 ,First,#,,WELL_NAME,-1,-1;WELL_NAME_SUFFIX \"WELL_NAME_SUFFIX\" true true false 8 Text 0 0 ,First,#,,WELL_NAME_SUFFIX,-1,-1;OPERATOR \"OPERATOR\" true true false 75 Text 0 0 ,First,#,,OPERATOR,-1,-1;BOTTOM_FIELD_NAME_CODE \"BOTTOM_FIELD_NAME_CODE\" true true false 8 Text 0 0 ,First,#,,BOTTOM_FIELD_NAME_CODE,-1,-1;SPUD_DATE \"SPUD_DATE\" true true false 255 Text 0 0 ,First,#,,SPUD_DATE,-1,-1;BOTTOM_LEASE_NUMBER \"BOTTOM_LEASE_NUMBER\" true true false 10 Text 0 0 ,First,#,,BOTTOM_LEASE_NUMBER,-1,-1;RKB_ELEVATION \"RKB_ELEVATION\" true true false 8 Double 0 0 ,First,#,,RKB_ELEVATION,-1,-1;BH_TOTAL_MD \"BH_TOTAL_MD\" true true false 8 Double 0 0 ,First,#,,BH_TOTAL_MD,-1,-1;TVD \"TVD\" true true false 8 Double 0 0 ,First,#,,TVD,-1,-1;SURFACE_NS_DISTANCE \"SURFACE_NS_DISTANCE\" true true false 8 Double 0 0 ,First,#,,SURFACE_NS_DISTANCE,-1,-1;SURFACE_NS_CODE \"SURFACE_NS_CODE\" true true false 1 Text 0 0 ,First,#,,SURFACE_NS_CODE,-1,-1;SURFACE_EW_DISTANCE \"SURFACE_EW_DISTANCE\" true true false 8 Double 0 0 ,First,#,,SURFACE_EW_DISTANCE,-1,-1;SURFACE_EW_CODE \"SURFACE_EW_CODE\" true true false 1 Text 0 0 ,First,#,,SURFACE_EW_CODE,-1,-1;SURFACE_BLOCK_NAME \"SURFACE_BLOCK_NAME\" true true false 255 Text 0 0 ,First,#,,SURFACE_BLOCK_NAME,-1,-1;BOTTOM_NS_DISTANCE \"BOTTOM_NS_DISTANCE\" true true false 8 Double 0 0 ,First,#,,BOTTOM_NS_DISTANCE,-1,-1;BOTTOM_NS_CODE \"BOTTOM_NS_CODE\" true true false 1 Text 0 0 ,First,#,,BOTTOM_NS_CODE,-1,-1;BOTTOM_EW_DISTANCE \"BOTTOM_EW_DISTANCE\" true true false 8 Double 0 0 ,First,#,,BOTTOM_EW_DISTANCE,-1,-1;BOTTOM_EW_CODE \"BOTTOM_EW_CODE\" true true false 1 Text 0 0 ,First,#,,BOTTOM_EW_CODE,-1,-1;BOTTOM_BLOCK_NAME \"BOTTOM_BLOCK_NAME\" true true false 255 Text 0 0 ,First,#,,BOTTOM_BLOCK_NAME,-1,-1;TOTAL_DEPTH_DATE \"TOTAL_DEPTH_DATE\" true true false 255 Text 0 0 ,First,#,,TOTAL_DEPTH_DATE,-1,-1;STATUS_DATE \"STATUS_DATE\" true true false 255 Text 0 0 ,First,#,,STATUS_DATE,-1,-1;TYPE_CODE \"TYPE_CODE\" true true false 1 Text 0 0 ,First,#,,TYPE_CODE,-1,-1;DISTRICT_CODE \"DISTRICT_CODE\" true true false 2 Text 0 0 ,First,#,,DISTRICT_CODE,-1,-1;STATUS_CODE \"STATUS_CODE\" true true false 3 Text 0 0 ,First,#,,STATUS_CODE,-1,-1;WATER_DEPTH \"WATER_DEPTH\" true true false 8 Double 0 0 ,First,#,,WATER_DEPTH,-1,-1;SURFACE_LONGITUDE \"SURFACE_LONGITUDE\" true true false 8 Double 0 0 ,First,#,,SURFACE_LONGITUDE,-1,-1;SURFACE_LATITUDE \"SURFACE_LATITUDE\" true true false 8 Double 0 0 ,First,#,,SURFACE_LATITUDE,-1,-1;BOTTOM_LONGITUDE \"BOTTOM_LONGITUDE\" true true false 8 Double 0 0 ,First,#,,BOTTOM_LONGITUDE,-1,-1;BOTTOM_LATITUDE \"BOTTOM_LATITUDE\" true true false 8 Double 0 0 ,First,#,,BOTTOM_LATITUDE,-1,-1;SURFACE_LEASE_NUMBER \"SURFACE_LEASE_NUMBER\" true true false 255 Text 0 0 ,First,#,,SURFACE_LEASE_NUMBER,-1,-1", "")

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:43:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574118#M44984</guid>
      <dc:creator>AdamGuo</dc:creator>
      <dc:date>2021-12-12T00:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574119#M44985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;It's a direct export from the model built.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That's probably one of your problems. I'd first clean up your code so it is legible.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also don't see any reference to the path from your error C:\Spatial.mdb\WELLS.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 19:50:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574119#M44985</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-01-21T19:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574120#M44986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry, I am not all that well versed with Python. I am still learning the ins and outs thus the exporting to script from model builder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The full error is here. I accidentally deleted the full path to the directory in the first post.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Users\guoax\Desktop\a.py", line 20, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeXYEventLayer_management(WELLS__4_, "SURFACE_LONGITUDE", "SURFACE_LATITUDE", WELLS_Layer, "GEOGCS['GCS_North_American_1927',DATUM['D_North_American_1927',SPHEROID['Clarke_1866',6378206.4,294.9786982]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98305509728916E-09;0.001;0.001;IsHighPrecision", "")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 6322, in MakeXYEventLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000732: XY Table: Dataset C:\FoB Oil and Gas\GoM\3_Compare\Compare.mdb\WELLS does not exist or is not supported&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (MakeXYEventLayer).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]20938[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 20:06:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574120#M44986</guid>
      <dc:creator>AdamGuo</dc:creator>
      <dc:date>2013-01-21T20:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574121#M44987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You need to set up a workspace to execute this outside ArcMap. The help has an example you can walk through to get an understanding of the &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000006z000000"&gt;MakeXYEventLayer tool&lt;/A&gt;&lt;SPAN&gt;. All the field mapping at the end of your fc2fc look unnecessary as well.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 20:22:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574121#M44987</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-01-21T20:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574122#M44988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've modified the code, and added a workspace environment, but it is still failing on me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000622: Failed to execute (Make XY Event Layer). Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000628: Cannot set input into parameter spatial_reference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import arcpy module
import arcpy

# Set the workspace environment to local file geodatabase
arcpy.env.workspace = r"C:\FoB Oil and Gas\GoM\WorkSpace.gdb"

try:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Local variables:
&amp;nbsp;&amp;nbsp;&amp;nbsp; WELLS_1 = "C:\\FoB Oil and Gas\\GoM\\GOM_Spatial.mdb\\WELLS"
&amp;nbsp;&amp;nbsp;&amp;nbsp; tbl = "C:\\FoB Oil and Gas\\GoM\\3_Compare\\Compare.mdb\\WELLS"
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr = "WELLS_Layer"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set the spatial reference
&amp;nbsp;&amp;nbsp;&amp;nbsp; spRef = r"Coordinate Systems\Geographic Coordinate Systems\North America\GCS_North_American_1927.prj"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process: Make XY Event Layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeXYEventLayer_management(tbl, "SURFACE_LONGITUDE", "SURFACE_LATITUDE", lyr, spRef, "")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Print the total rows
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetCount_management(lyr)

except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:43:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574122#M44988</guid>
      <dc:creator>AdamGuo</dc:creator>
      <dc:date>2021-12-12T00:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574123#M44989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I guess the help may not have been updated for 10.1. Spatial references can be set using a spatial reference object. You can see this thread for details on a work around.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/64242-Path-to-.prj-files-in-ArcGIS-v10.1"&gt;http://forums.arcgis.com/threads/64242-Path-to-.prj-files-in-ArcGIS-v10.1&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can also try creating it without a spatial reference for troubleshooting.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 21:24:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574123#M44989</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-01-21T21:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574124#M44990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I just tried w/o the spatial ref. I am still getting this parameters are not valid error. I even tried exporting the table out to an excel file and replace the path. Everything works fine inside either ArcMap or Model Builder, just not in Python..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Executing: MakeXYEventLayer "C:\FoB Oil and Gas\GoM\3_Compare\Compare.mdb\WELLS" SURFACE_LONGITUDE SURFACE_LATITUDE WELLS_Layer # #&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Start Time: Mon Jan 21 17:29:38 2013&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000732: XY Table: Dataset C:\FoB Oil and Gas\GoM\3_Compare\Compare.mdb\WELLS does not exist or is not supported&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (MakeXYEventLayer).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed at Mon Jan 21 17:29:38 2013 (Elapsed Time: 0.00 seconds)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import arcpy module
import arcpy

# Set the workspace environment to local file geodatabase
arcpy.env.workspace = r"C:\FoB Oil and Gas\GoM\WorkSpace.gdb"

try:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Local variables:
&amp;nbsp;&amp;nbsp;&amp;nbsp; tbl = "C:\\FoB Oil and Gas\\GoM\\3_Compare\\Compare.mdb\\WELLS"
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr = "WELLS_Layer"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process: Make XY Event Layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeXYEventLayer_management(tbl, "SURFACE_LONGITUDE", "SURFACE_LATITUDE", lyr, "", "")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Print the total rows
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetCount_management(lyr)

except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:43:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574124#M44990</guid>
      <dc:creator>AdamGuo</dc:creator>
      <dc:date>2021-12-12T00:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574125#M44991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Adam, I only suggest this to help speed up getting this problem solved and end your frustration -&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you can, also post a small sample of your table.&amp;nbsp; If it is small enough, zip and attach your mdb.&amp;nbsp; Any reason you aren't using a file gdb?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 22:09:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574125#M44991</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-01-21T22:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574126#M44992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here's the attached sample of the PGDB. The reason I am using PGDB is for Microsoft Access. I have a lot of queries, macros and links created to produce the end result table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 22:39:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574126#M44992</guid>
      <dc:creator>AdamGuo</dc:creator>
      <dc:date>2013-01-21T22:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574127#M44993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am not sure what is going wrong with yours.&amp;nbsp; I was able to get this to work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
#Import arcpy module
import arcpy, os

# Set the workspace environment to local file geodatabase
arcpy.env.workspace = ws = r"C:\FoB Oil and Gas\GoM\WorkSpace.gdb"
spa_ref = r'C:\Program Files (x86)\ArcGIS\Desktop10.0\Coordinate Systems\Geographic Coordinate Systems\North America\NAD 1927.prj'

try:

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Local variables:
&amp;nbsp;&amp;nbsp;&amp;nbsp; tbl = r"C:\FoB Oil and Gas\GoM\3_Compare\Compare.mdb\WELLS"
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr = "WELLS_Layer"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process: Make XY Event Layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeXYEventLayer_management(tbl, "SURFACE_LONGITUDE", "SURFACE_LATITUDE", lyr, spa_ref)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Print the total rows
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetCount_management(lyr)

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureClassToFeatureClass_conversion(lyr, ws, 'WELLS_Points')
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Created Feature Class'

except:

&amp;nbsp;&amp;nbsp;&amp;nbsp; tb = sys.exc_info()[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp; tbinfo = traceback.format_tb(tb)[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; pymsg = "PYTHON ERRORS:\nTraceback Info:\n" + tbinfo + "\nError Info:\n\t" + \
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; str(sys.exc_type) + ": " + str(sys.exc_value) + "\n"
&amp;nbsp;&amp;nbsp;&amp;nbsp; msgs = "ARCPY ERRORS:\n" + arcpy.GetMessages(2) + "\n"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError(msgs)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError(pymsg)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print msgs
&amp;nbsp;&amp;nbsp;&amp;nbsp; print pymsg
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(arcpy.GetMessages(1))
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages(1)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I did this using version 10. If you are at 10.1 you will need to find the factory code for the NAD 1927.&amp;nbsp; Also, not sure if it is causing the problem, but it is best to not have spaces in your folder names.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:43:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574127#M44993</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T00:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574128#M44994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yeah, probably this isn't your problem, but if I were you (at least to eliminate it as a potential problem), I would not include the final optional 'Z' parameter.&amp;nbsp; You don't have one to enter here anyway....and I noticed Caleb's code didn't have it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Other than that, the spatial reference object is interesting......not sure, but I think you need this line to set the spatial ref at 10.1:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sr = arcpy.SpatialReference(factoryCode)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Where factoryCode is the WKID (well-known ID), that isn't so well known (just a small joke there, sorry).&amp;nbsp; Maybe wrong, but this may set if correctly for you:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sr = arcpy.SpatialReference(104145)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But you have to check it...I got the value from:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/018z/pdf/geographic_coordinate_systems.pdf"&gt;http://resources.arcgis.com/en/help/main/10.1/018z/pdf/geographic_coordinate_systems.pdf&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SpatialReference (arcpy)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Desktop » Geoprocessing » ArcPy » ArcPy classes&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018z0000000v000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//018z0000000v000000&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 23:45:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574128#M44994</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-01-21T23:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574129#M44995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;sr = arcpy.SpatialReference(factoryCode)&lt;BR /&gt;&lt;BR /&gt;Where factoryCode is the WKID (well-known ID), that isn't so well known (just a small joke there, sorry). Maybe wrong, but this may set if correctly for you:&lt;BR /&gt;&lt;BR /&gt;sr = arcpy.SpatialReference(104145)&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Interesting...I do not know why the 10.1 help says that you have to create the Spatial Reference object like that.&amp;nbsp; I have 10.1 at work so I was able to test this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process: Make XY Event Layer,&amp;nbsp; WKID 4267 is NAD 1927 in 10.1
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeXYEventLayer_management(tbl, "SURFACE_LONGITUDE", "SURFACE_LATITUDE", lyr, 4267)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This worked perfectly.&amp;nbsp; Apparently, you can just put the WKID in as the spa ref parameter without using the "sr = arcpy.SpatialReference(104145)" technique.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:43:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574129#M44995</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T00:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574130#M44996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;...sorry if a little off topic Adam -- I question your original statement:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"I am running Win 7 64 bit 10.1 SP1 with Geoprocessing for SP1 updated as well."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you install 64 bit background geoprocessing?&amp;nbsp; If so, you may be having trouble reading 32 bit apps...xls, mdb, etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If that's your trouble, see Kevin Hibma's comment here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"If you have 64bit BG and want to execute against 32bit Python (32bit Desktop) because you're using pGDBs, force your script to run against 32bit..."&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://forums.arcgis.com/threads/70241-10.1-sp-1-and-32-64-bit-Python-versions?p=245700#post245700" rel="nofollow" target="_blank"&gt;http://forums.arcgis.com/threads/70241-10.1-sp-1-and-32-64-bit-Python-versions?p=245700#post245700&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also this, if it applies to your situation:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://blogs.esri.com/esri/arcgis/2012/10/31/announcing-64-bit-geoprocessing/" rel="nofollow" target="_blank"&gt;http://blogs.esri.com/esri/arcgis/2012/10/31/announcing-64-bit-geoprocessing/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS - Thanks to Caleb for that spatial reference info...think Adam will need that as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2013 13:45:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574130#M44996</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-01-22T13:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574131#M44997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you all for the suggestions. Wayne you were right about the 32/64 bit. Apparently I was running the 64bit python instead of the 32bit. I created a batch to run the script in 32 bit and it worked perfectly. Now I just need to figure out how to hard code it into the scripts when I create them in the future.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks you all again for your help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2013 14:43:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574131#M44997</guid>
      <dc:creator>AdamGuo</dc:creator>
      <dc:date>2013-01-22T14:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: Make XY Event Layer  in Python Crashes But Not in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574132#M44998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Then you could run in foreground, or you may heed Chris Snyder's valuable contribution here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/75207-Excel-and-Python-Friends-or-Foes?p=263825#post263825"&gt;http://forums.arcgis.com/threads/75207-Excel-and-Python-Friends-or-Foes?p=263825#post263825&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2013 15:11:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-xy-event-layer-nbsp-in-python-crashes-but-not/m-p/574132#M44998</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-01-22T15:11:49Z</dc:date>
    </item>
  </channel>
</rss>

