<?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: ArcPy script error in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-script-error/m-p/386009#M30449</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah good point. I'll edit the original post as such. thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Jul 2016 18:50:57 GMT</pubDate>
    <dc:creator>RusselKlueg</dc:creator>
    <dc:date>2016-07-12T18:50:57Z</dc:date>
    <item>
      <title>ArcPy script error</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-script-error/m-p/386007#M30447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got a question on arcpy. I have a script that is going to select some features out of a few hundred feature classes and export them based off of proximity to my desired location. My issue is I keep getting the 000210 which, to my understanding, means i do not have access to the database I'm trying to write to. I've included my script and error message below. If anyone has any ideas on what might be causing this, i would greatly appreciate the guidance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;'''
Created by SGT Russel Klueg
11 JULY 16


About: This script is meant to increase the response time of data creation
by allowing for the earthquake to be put in and outputting KMLs of all critical
infrastructure within a set distance of the location.
'''


import os, time, arcpy, csv
from arcpy import env


#Allows data to be overwritten
env.overwriteOutput = True
path = r'C:\Users\JOC-001\Desktop\Python Scripts\Earthquake\Earthquake Infrastructure.mxd'
#sets the path listed as the Map Document
mxd = arcpy.mapping.MapDocument(path)
#declares the Dataframe
df = "HSIP"
outPath = 'C:/Users/JOC-001/Documents/ArcGIS/Scratch.gdb/'
env.workspace = outPath
sr = arcpy.SpatialReference("WGS 1984")


#Takes the current time and creates a folder from it in YYYYMMDD HHMM format
current = time.strftime('%Y%m%d %H%M')
os.mkdir(current)
earthquake = 'C:/Users/JOC-001/Desktop/Python Scripts/Earthquake/'
folder = earthquake + current + '/'
print("The output folder for this entire process is below:\n" + folder)


#the next few lines take a verified user input to use as the Lat and Long 
lat = float(raw_input("Please enter the Latitude of the event." + \
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "\nNumber should range between between 36.5 and 42.5\n"))
while lat &amp;lt; 36.5 or lat &amp;gt; 42.5:
&amp;nbsp;&amp;nbsp;&amp;nbsp; lat = float(raw_input("Please enter a valid Latitude between 36.5 and 42.5\n"))
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
long = float(raw_input("Please enter the Longitude of the event." + \
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "\nNumber should range between between -87 and -92\n"))
while long &amp;lt; -92 or long &amp;gt; -87:
&amp;nbsp;&amp;nbsp;&amp;nbsp; long = float(raw_input("Please enter a valid Longitude between -87 and -92\n"))


finalCoords = folder + 'coords.csv'
#Creates a csv file and moves it into the appropriate folder
with open('coords.csv', 'wb') as coords:
&amp;nbsp;&amp;nbsp;&amp;nbsp; writer = csv.writer(coords, delimiter=',')
&amp;nbsp;&amp;nbsp;&amp;nbsp; data = [['Lat', 'Long'],[lat, long]]
&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.writerows(data)
os.rename(earthquake+'coords.csv', finalCoords)


#Creatst the layer, converts to .shp and buffers it at 50 miles.
eventPoint = folder + 'event.lyr'
arcpy.MakeXYEventLayer_management(finalCoords, 'Long', 'Lat', 'Event', sr)
arcpy.SaveToLayerFile_management('Event', eventPoint)
arcpy.FeatureClassToFeatureClass_conversion(eventPoint, outPath, 'finalPoint')
arcpy.Buffer_analysis(outPath + 'finalPoint', 'pointBuffer', '50 Miles')
bufferFile = outPath + 'pointBuffer'


#Iterates through every single layer in the MXD and selects data and exports it.
for lyr in arcpy.mapping.ListLayers(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if not lyr.isGroupLayer:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = lyr.name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByLocation_management(lyr, 'INTERSECT', bufferFile)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(lyr, name)


os.system('pause')&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Users\JOC-001\Desktop\Python Scripts\Earthquake\Earthquake.py", line 67, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(lyr, name)&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\management.py", line 2429, in CopyFeatures&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/P&gt;&lt;P&gt;ExecuteError: ERROR 000210: Cannot create output C:/Users/JOC-001/Documents/ArcGIS/Scratch.gdb\Animal Aquaculture Facilities&lt;/P&gt;&lt;P&gt;Failed to execute (CopyFeatures).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:44:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-script-error/m-p/386007#M30447</guid>
      <dc:creator>RusselKlueg</dc:creator>
      <dc:date>2021-12-11T17:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy script error</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-script-error/m-p/386008#M30448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just saving some people time:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;'''
Created by SGT Russel Klueg
11 JULY 16

About: This script is meant to increase the response time of data creation
by allowing for the earthquake to be put in and outputting KMLs of all critical
infrastructure within a set distance of the location.
'''

import os, time, arcpy, csv
from arcpy import env

#Allows data to be overwritten
env.overwriteOutput = True
path = r'C:\Users\JOC-001\Desktop\Python Scripts\Earthquake\Earthquake Infrastructure.mxd'
#sets the path listed as the Map Document
mxd = arcpy.mapping.MapDocument(path)
#declares the Dataframe
df = "HSIP"
outPath = 'C:/Users/JOC-001/Documents/ArcGIS/Scratch.gdb/'
env.workspace = outPath
sr = arcpy.SpatialReference("WGS 1984")

#Takes the current time and creates a folder from it in YYYYMMDD HHMM format
current = time.strftime('%Y%m%d %H%M')
os.mkdir(current)
earthquake = 'C:/Users/JOC-001/Desktop/Python Scripts/Earthquake/'
folder = earthquake + current + '/'
print("The output folder for this entire process is below:\n" + folder)

#the next few lines take a verified user input to use as the Lat and Long 
lat = float(raw_input("Please enter the Latitude of the event." + \
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "\nNumber should range between between 36.5 and 42.5\n"))
while lat &amp;lt; 36.5 or lat &amp;gt; 42.5:
&amp;nbsp;&amp;nbsp;&amp;nbsp; lat = float(raw_input("Please enter a valid Latitude between 36.5 and 42.5\n"))
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
long = float(raw_input("Please enter the Longitude of the event." + \
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "\nNumber should range between between -87 and -92\n"))
while long &amp;lt; -92 or long &amp;gt; -87:
&amp;nbsp;&amp;nbsp;&amp;nbsp; long = float(raw_input("Please enter a valid Longitude between -87 and -92\n"))

finalCoords = folder + 'coords.csv'
#Creates a csv file and moves it into the appropriate folder
with open('coords.csv', 'wb') as coords:
&amp;nbsp;&amp;nbsp;&amp;nbsp; writer = csv.writer(coords, delimiter=',')
&amp;nbsp;&amp;nbsp;&amp;nbsp; data = [['Lat', 'Long'],[lat, long]]
&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.writerows(data)
os.rename(earthquake+'coords.csv', finalCoords)

#Creatst the layer, converts to .shp and buffers it at 50 miles.
eventPoint = folder + 'event.lyr'
arcpy.MakeXYEventLayer_management(finalCoords, 'Long', 'Lat', 'Event', sr)
arcpy.SaveToLayerFile_management('Event', eventPoint)
arcpy.FeatureClassToFeatureClass_conversion(eventPoint, outPath, 'finalPoint')
arcpy.Buffer_analysis(outPath + 'finalPoint', 'pointBuffer', '50 Miles')
bufferFile = outPath + 'pointBuffer'

#Iterates through every single layer in the MXD and selects data and exports it.
for lyr in arcpy.mapping.ListLayers(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if not lyr.isGroupLayer:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = lyr.name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByLocation_management(lyr, 'INTERSECT', bufferFile)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(lyr, name)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Users\JOC-001\Desktop\Python Scripts\Earthquake\Earthquake.py", line 67, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(lyr, name)&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\management.py", line 2429, in CopyFeatures&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/P&gt;&lt;P&gt;ExecuteError: ERROR 000210: Cannot create output C:/Users/JOC-001/Documents/ArcGIS/Scratch.gdb\Animal Aquaculture Facilities&lt;/P&gt;&lt;P&gt;Failed to execute (CopyFeatures).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:44:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-script-error/m-p/386008#M30448</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-11T17:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy script error</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-script-error/m-p/386009#M30449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah good point. I'll edit the original post as such. thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jul 2016 18:50:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-script-error/m-p/386009#M30449</guid>
      <dc:creator>RusselKlueg</dc:creator>
      <dc:date>2016-07-12T18:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy script error</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-script-error/m-p/386010#M30450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The path given with the ERROR 000210 seems goofy, the single backslash with the others being forward slashes.&amp;nbsp; My first guess, you are having an issue creating a valid path for an output.&amp;nbsp; Start by putting some print statements in before executing functions to see what exactly the paths look like that you are passing to different functions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jul 2016 19:34:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-script-error/m-p/386010#M30450</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2016-07-12T19:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy script error</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-script-error/m-p/386011#M30451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no time to look in detail, but I am rapidly discovering that any type of slash at the end of a path is not appreciated even if raw formatting is used.... I said appreciated, not necessarily causing an error, until something uses it...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jul 2016 19:48:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-script-error/m-p/386011#M30451</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-07-12T19:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy script error</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-script-error/m-p/386012#M30452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'll add print statements for all of the paths and I'll reformat so that the slash is added between the file name and the path. I'll update when I have results. Thanks for your help, gentlemen!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2016 12:17:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-script-error/m-p/386012#M30452</guid>
      <dc:creator>RusselKlueg</dc:creator>
      <dc:date>2016-07-13T12:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy script error</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-script-error/m-p/386013#M30453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe I have the issue. I'm using the lyr.name to name the files that are output. The issue with this is that the layer names have spaces in them. I believe if I format those it will fix the issue. Kind of disappointed in myself for overlooking this...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2016 12:44:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-script-error/m-p/386013#M30453</guid>
      <dc:creator>RusselKlueg</dc:creator>
      <dc:date>2016-07-13T12:44:12Z</dc:date>
    </item>
  </channel>
</rss>

