<?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: CopyFeatures_management Crashes on Second Iteration Through Loop in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/copyfeatures-management-crashes-on-second/m-p/228529#M17726</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The whitepaper on ESRI's shapefile spec establishes an '8.3' naming convention, meaning 8 characters for the name, 3 for the file extension...so either try shortening the name or use a gdb fc format.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the Shapefile Specification:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf"&gt;http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"...start with an alphanumeric character (a�??Z, 0�??9), followed by zero or up to seven characters (a�??Z, 0�??9, _, -)."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example, maybe simply '20130625.shp'...etc., or if you want something more 'informative', give a more sensible descriptor for the name and store the date somewhere else.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 14 Dec 2013 22:33:09 GMT</pubDate>
    <dc:creator>T__WayneWhitley</dc:creator>
    <dc:date>2013-12-14T22:33:09Z</dc:date>
    <item>
      <title>CopyFeatures_management Crashes on Second Iteration Through Loop</title>
      <link>https://community.esri.com/t5/python-questions/copyfeatures-management-crashes-on-second/m-p/228528#M17725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've created an XY Event Layer, and now I want to copy that to a shape file.&amp;nbsp; It works fine on the first iteration, but crashes on the second iteration.&amp;nbsp; What seems odd, when looking in my geodatabase, the first shapefile is not named correctly; it is just called "shp", but I'm trying to name it "Data_20130626.shp".&amp;nbsp; Is there a problem in my naming syntax for ShapeName?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any help you can provide!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jon Mulder&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# Set the workspace.
env.workspace = "G:\Documents\GIS\HydstraData"
arcpy.env.overwriteOutput = True

## Set the Spatial Reference.
Spatial_Reference = "PROJCS['NAD_1983_California_Teale_Albers',GEOGCS['GCS_North_American_1983',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Albers'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',-4000000.0],PARAMETER['Central_Meridian',-120.0],PARAMETER['Standard_Parallel_1',34.0],PARAMETER['Standard_Parallel_2',40.5],PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]"

OutFolderPath = env.workspace
OutName = "tempgdb.gdb"
##Check if geodatabase exists.
if arcpy.Exists(OutName):
&amp;nbsp;&amp;nbsp;&amp;nbsp; ##Delete geodatabase.
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(OutName)
##Create geodatabase.&amp;nbsp;&amp;nbsp;&amp;nbsp; 
arcpy.CreateFileGDB_management(OutFolderPath,OutName)

DateStart = date(2013,6,25)
DateEnd = date(2013,6,26)
for dt in rrule(DAILY, dtstart=DateStart, until=DateEnd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; CurrentDate = dt.strftime("%Y%m%d")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print CurrentDate
&amp;nbsp;&amp;nbsp;&amp;nbsp; ##Create Point Shapefile from spreadsheet.
&amp;nbsp;&amp;nbsp;&amp;nbsp; InSpreadsheet = "G:\Documents\GIS\HydstraData\HydstraMeasurementsDeep\HydstraMeasurements_" + CurrentDate + ".XLS"
&amp;nbsp;&amp;nbsp;&amp;nbsp; X_Coords = "LONGITUDE"
&amp;nbsp;&amp;nbsp;&amp;nbsp; Y_Coords = "LATITUDE"
&amp;nbsp;&amp;nbsp;&amp;nbsp; Z_Coords = "MeanData"
&amp;nbsp;&amp;nbsp;&amp;nbsp; TableName = os.path.join(OutFolderPath,OutName,"Data_" + CurrentDate)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print TableName
&amp;nbsp;&amp;nbsp;&amp;nbsp; LayerName = os.path.join(OutFolderPath,OutName,"Data_" + CurrentDate + ".lyr")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print LayerName
&amp;nbsp;&amp;nbsp;&amp;nbsp; ShapeName = os.path.join(OutFolderPath,OutName,"Data_" + CurrentDate + ".shp")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print ShapeName
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ExcelToTable_conversion(InSpreadsheet,TableName)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeXYEventLayer_management(TableName,X_Coords,Y_Coords,LayerName,"",Z_Coords)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(LayerName,ShapeName)
print "Completed."&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;===Outout in Python Shell================================&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;20130625&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;G:\Documents\GIS\HydstraData\tempgdb.gdb\Data_20130625&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;G:\Documents\GIS\HydstraData\tempgdb.gdb\Data_20130625.lyr&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;G:\Documents\GIS\HydstraData\tempgdb.gdb\Data_20130625.shp&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;20130626&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;G:\Documents\GIS\HydstraData\tempgdb.gdb\Data_20130626&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;G:\Documents\GIS\HydstraData\tempgdb.gdb\Data_20130626.lyr&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;G:\Documents\GIS\HydstraData\tempgdb.gdb\Data_20130626.shp&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 "G:\Documents\GIS\HydstraData\CreateATinFromPoints_Mulder_20131212.py", line 55, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(LayerName,ShapeName)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\management.py", line 2281, in CopyFeatures&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: ERROR 000210: Cannot create output G:\Documents\GIS\HydstraData\tempgdb.gdb\Data_20130626.shp&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (CopyFeatures).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Dec 2013 21:25:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copyfeatures-management-crashes-on-second/m-p/228528#M17725</guid>
      <dc:creator>JonathanMulder</dc:creator>
      <dc:date>2013-12-13T21:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: CopyFeatures_management Crashes on Second Iteration Through Loop</title>
      <link>https://community.esri.com/t5/python-questions/copyfeatures-management-crashes-on-second/m-p/228529#M17726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The whitepaper on ESRI's shapefile spec establishes an '8.3' naming convention, meaning 8 characters for the name, 3 for the file extension...so either try shortening the name or use a gdb fc format.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the Shapefile Specification:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf"&gt;http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"...start with an alphanumeric character (a�??Z, 0�??9), followed by zero or up to seven characters (a�??Z, 0�??9, _, -)."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example, maybe simply '20130625.shp'...etc., or if you want something more 'informative', give a more sensible descriptor for the name and store the date somewhere else.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Dec 2013 22:33:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copyfeatures-management-crashes-on-second/m-p/228529#M17726</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2013-12-14T22:33:09Z</dc:date>
    </item>
  </channel>
</rss>

