<?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:  outFeatureClass/arcpy.CopyFeatures_management in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407071#M32057</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;back to your original question....first, I would recommend commenting out the &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteFeatures_management(i) &lt;/P&gt;&lt;P&gt;line until you have it running.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you tried it without including the GISADMIN owner in the name?&amp;nbsp; I know different ArcGIS versions have switched back and forth as to whether it wants it or it doesn't.&amp;nbsp; I've had script that ran perfectly in one version, only to have to modify it to allow for the opposite situation in a different version.&amp;nbsp; Running it manually once, then copying the python snippet from the results tab might help you see the format it wants in your version.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I'm assuming you have many than just these two?&amp;nbsp; If not, I would just do it manually and be done with it. If you have many, rather than having a whole string of&amp;nbsp;&amp;nbsp; If == statements, maybe make an array with the old and new names&amp;nbsp;&amp;nbsp; [[old1, new1], [old2, new2], []...]&amp;nbsp;&amp;nbsp; and loop thru that, or if you are just trying to remove the spaces in the name, you can do some string manipulation on the .shp name from your listfeatures to automate the new name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just some ideas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Dec 2015 16:28:58 GMT</pubDate>
    <dc:creator>RebeccaStrauch__GISP</dc:creator>
    <dc:date>2015-12-29T16:28:58Z</dc:date>
    <item>
      <title>outFeatureClass/arcpy.CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407061#M32047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to automate a shapefile to feature class update. The problem is that the shapefile name and output (feature class) are not the same.&lt;/P&gt;&lt;P&gt;So I need to hard code the shp &amp;amp; features.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a loop that works, printing out the shapefile names.&lt;/P&gt;&lt;P&gt;The code fails when I try to use the arcpy.CopyFeatures_management function.&lt;/P&gt;&lt;P&gt;Can anyone see what is causing the arcpy.CopyFeatures_management function to fail??&lt;/P&gt;&lt;P&gt;Would appreciate a suggestion to resolve the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import glob
import os
import sys
import csv
import time
import smtplib
import shutil
import ftplib


sdeConnection = arcpy.env.workspace = r"C:\database_connections\GIST.sde"
outWorkspace =sdeConnection

datadir = arcpy.env.workspace = r"\\server1\ER Shares\Highway_Layer_Update" &lt;STRONG&gt;## URL works&lt;/STRONG&gt;

try:
&amp;nbsp;&amp;nbsp;&amp;nbsp; #check file exists here
&amp;nbsp;&amp;nbsp;&amp;nbsp; fcList = arcpy.ListFeatureClasses()

&amp;nbsp;&amp;nbsp;&amp;nbsp; ## Feature classes are hard coded
&amp;nbsp;&amp;nbsp;&amp;nbsp; ## Feature classes are hard coded
&amp;nbsp;&amp;nbsp;&amp;nbsp; for i in fcList:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if i == "Bus Stops.shp":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #outFeatureClass = os.path.join(outWorkspace, shapefile.strip(".shp"))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.CopyFeatures_management(shapefile, outFeatureClass)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print i&amp;nbsp; ## NO shp
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcnew = "GISADMIN.KCC_BUSSTOPS_NEW"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFeatureClass = os.path.join(outWorkspace, fcnew )
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(i,&amp;nbsp; outFeatureClass)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteFeatures_management(i)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif i == "Cluster_sites_2014.shp":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print i&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;## Prints shp&lt;/STRONG&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcnew = "GISADMIN.KCC_KHS_CLUSTERS_2014_NEW"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFeatureClass = os.path.join(outWorkspace, fcnew )&amp;nbsp; &lt;STRONG&gt;## Fails&lt;/STRONG&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printoutFeatureClass
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(i, outFeatureClass)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteFeatures_management(i)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "No file"
except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print ("No File found program terminated") &lt;STRONG&gt; ## This is printed out&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Dan Patterson
I formatted your code to make it easier to read... use the syntax highlighting ... &amp;gt;&amp;gt; ... and select Python&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:30:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407061#M32047</guid>
      <dc:creator>CliveSwan</dc:creator>
      <dc:date>2021-12-11T18:30:48Z</dc:date>
    </item>
    <item>
      <title>Re:  outFeatureClass/arcpy.CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407062#M32048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What's up with line 36?&amp;nbsp;&amp;nbsp; printoutFeatureClass&amp;nbsp;&amp;nbsp; perhaps print outFeatureClass &lt;/P&gt;&lt;P&gt;So you are saying that it failed.&amp;nbsp; Did you get an error message? and if so, what was it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2015 13:44:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407062#M32048</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-29T13:44:58Z</dc:date>
    </item>
    <item>
      <title>Re:  outFeatureClass/arcpy.CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407063#M32049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd try to uncover what the actual error is first.&amp;nbsp; You can either simply remove the try/except block and it should print the traceback, or just update your except to print the actual error rather than "No File found program termintated" (you will need to add another import statement with the code below...&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;&lt;SPAN style="font-family: Consolas;"&gt;import traceback&lt;/SPAN&gt;

&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'do stuff


&amp;nbsp; except:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exc_traceback = sys.exc_info()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print traceback.print_exc()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:30:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407063#M32049</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T18:30:50Z</dc:date>
    </item>
    <item>
      <title>Re:  outFeatureClass/arcpy.CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407064#M32050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A typo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just printed out the except block message, not helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2015 13:58:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407064#M32050</guid>
      <dc:creator>CliveSwan</dc:creator>
      <dc:date>2015-12-29T13:58:06Z</dc:date>
    </item>
    <item>
      <title>Re:  outFeatureClass/arcpy.CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407065#M32051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with James.&amp;nbsp; People spend more time trying to debug try-except blocks...or worse interpreting them.&amp;nbsp;&amp;nbsp; Having the listfeatureclasses within the try except block is an example.&amp;nbsp; If you had that line outside, followed by a print statement, you would at least know it got that far.&amp;nbsp; Also, a judicious use of print statements will allow you to see at each step whether a block succeeded.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2015 14:11:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407065#M32051</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-29T14:11:03Z</dc:date>
    </item>
    <item>
      <title>Re:  outFeatureClass/arcpy.CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407066#M32052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi James,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That provides a far more useful error message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clive&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2015 14:19:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407066#M32052</guid>
      <dc:creator>CliveSwan</dc:creator>
      <dc:date>2015-12-29T14:19:14Z</dc:date>
    </item>
    <item>
      <title>Re:  outFeatureClass/arcpy.CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407067#M32053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As Dan mentioned, the try/except block can be a double-edge sword sometimes, especially at design-time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I personally don't really employ them until I'm ready to build a test deployment version because I just want to see the tracebacks when they hit the Interactive Window (PythonWin).&amp;nbsp; Even then, the print or arcpy.AddMessage methods don't help much for much of my deployed implementations and I will typically use these try/catch blocks for writing out log events.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2015 14:27:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407067#M32053</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2015-12-29T14:27:02Z</dc:date>
    </item>
    <item>
      <title>Re:  outFeatureClass/arcpy.CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407068#M32054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As an example...consider the variants of the simple script...&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #C6C6C6;" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: left; background-color: #f2f2f2; color: #505050; padding: 6px;" valign="middle"&gt;&lt;STRONG&gt;Header 1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: left; background-color: #f2f2f2; color: #505050; padding: 6px;" valign="middle"&gt;&lt;STRONG&gt;Header 2&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# version 1
print(something)&lt;/PRE&gt;&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Python34\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec(codeObject, __main__.__dict__)&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "F:\B_Python_3_\Python_1_to_edit\try_except_demo.py", line 1, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(something)&lt;/P&gt;&lt;P&gt;NameError: name 'something' is not defined&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# version 2
try:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print(something)
except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print("ooops")&lt;/PRE&gt;&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;&amp;gt;&amp;gt;&amp;gt; ooops&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 6px;"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# version 3
import sys
import traceback
try:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print(something)
except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; exc_traceback = sys.exc_info()
&amp;nbsp;&amp;nbsp;&amp;nbsp; print(traceback.print_exc())&lt;/PRE&gt;&lt;/TD&gt;&lt;TD style="padding: 6px;"&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "F:\B_Python_3_\Python_1_to_edit\try_except_demo.py", line 5, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(something)&lt;/P&gt;&lt;P&gt;NameError: name 'something' is not defined&lt;/P&gt;&lt;P&gt;None&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now...when developing scripts, I will leave it to the user to decide which is quicker in finding errors (dumb or otherwise) and which is the more informative&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:30:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407068#M32054</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T18:30:53Z</dc:date>
    </item>
    <item>
      <title>Re:  outFeatureClass/arcpy.CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407069#M32055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great illustration.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just started using the exc_traceback to simplify the error as I rarely need (or understand!) the error and line references to the actual modules/packages.&amp;nbsp; But most of the time I don't even have try/catch during development!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2015 14:56:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407069#M32055</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2015-12-29T14:56:53Z</dc:date>
    </item>
    <item>
      <title>Re:  outFeatureClass/arcpy.CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407070#M32056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;True... and since we have hijacked the thread, no one else cares and since you use pythonwin... the barebones error from the scriptutils.py script&lt;/P&gt;&lt;P&gt;("C:\Python34\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py")&lt;/P&gt;&lt;P&gt;tries to execute line 326.&amp;nbsp; Which I found was the line where...when everything else fails...pythonwin, finally tries to execute the script code using the variable from the dictionary&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;exec(codeObject, __main__.__dict__)&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;and of course, there is nothing in...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; locals().keys()
dict_keys(['__builtins__', '__loader__', '__doc__', 'pywin', '__name__', '__spec__', '__package__'])
&amp;gt;&amp;gt;&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;called 'something'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:30:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407070#M32056</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T18:30:55Z</dc:date>
    </item>
    <item>
      <title>Re:  outFeatureClass/arcpy.CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407071#M32057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;back to your original question....first, I would recommend commenting out the &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteFeatures_management(i) &lt;/P&gt;&lt;P&gt;line until you have it running.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you tried it without including the GISADMIN owner in the name?&amp;nbsp; I know different ArcGIS versions have switched back and forth as to whether it wants it or it doesn't.&amp;nbsp; I've had script that ran perfectly in one version, only to have to modify it to allow for the opposite situation in a different version.&amp;nbsp; Running it manually once, then copying the python snippet from the results tab might help you see the format it wants in your version.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I'm assuming you have many than just these two?&amp;nbsp; If not, I would just do it manually and be done with it. If you have many, rather than having a whole string of&amp;nbsp;&amp;nbsp; If == statements, maybe make an array with the old and new names&amp;nbsp;&amp;nbsp; [[old1, new1], [old2, new2], []...]&amp;nbsp;&amp;nbsp; and loop thru that, or if you are just trying to remove the spaces in the name, you can do some string manipulation on the .shp name from your listfeatures to automate the new name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just some ideas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2015 16:28:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407071#M32057</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2015-12-29T16:28:58Z</dc:date>
    </item>
    <item>
      <title>Re:  outFeatureClass/arcpy.CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407072#M32058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I amended the code, the error message indicated there was an existing Feature class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The arcpy.copymanagement works, the arcpy.deletemanagement still fails??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sdeConnection = arcpy.env.workspace = r"C:\database_connections\GIST.sde"&lt;/P&gt;&lt;P&gt;outWorkspace =sdeConnection&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;datadir = arcpy.env.workspace = r"\\server1\\GISData\Highway_Layer_Update"&lt;/P&gt;&lt;P&gt;##print datadir&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##check file exists here&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcList = arcpy.ListFeatureClasses()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for i in fcList:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if i == "Bus Stops.shp":&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ### no file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #outFeatureClass = os.path.join(outWorkspace, shapefile.strip(".shp"))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.CopyFeatures_management(shapefile, outFeatureClass)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print i&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcnewbus = "GISADMIN.BUSSTOPS_NEW"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outbus = os.path.join(outWorkspace, fcnewbus )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(i,&amp;nbsp; outbus)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteFeatures_management(r"\\server1\\GISData\Highway_Layer_Update\Bus Stops.shp")&lt;/P&gt;&lt;P&gt;##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.DeleteFeatures_management(datadir + "\Bus Stops.shp")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif i == "Cluster_sites.shp":&amp;nbsp; ## file exsists&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print i&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcnewcluster = "GISADMIN.CLUSTERS_NEW"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outcluster = os.path.join(outWorkspace, fcnewcluster)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(i, outcluster)&amp;nbsp;&amp;nbsp; ## WORKS!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteFeatures_management(r"r"\\server1\\GISData\Highway_Layer_Update\Cluster_sites.shp")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ## DELETE FAILS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##arcpy.DeleteFeatures_management(datadir + "\Cluster_sites_2014.shp")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error message existing connexion forcibly closed????&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Message&lt;/TD&gt;&lt;TD&gt;File Name&lt;/TD&gt;&lt;TD&gt;Line&lt;/TD&gt;&lt;TD&gt;Position&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Traceback&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; __call__&lt;/TD&gt;&lt;TD&gt;C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\netref.py&lt;/TD&gt;&lt;TD&gt;196&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; syncreq&lt;/TD&gt;&lt;TD&gt;C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\netref.py&lt;/TD&gt;&lt;TD&gt;71&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sync_request&lt;/TD&gt;&lt;TD&gt;C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\protocol.py&lt;/TD&gt;&lt;TD&gt;431&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; serve&lt;/TD&gt;&lt;TD&gt;C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\protocol.py&lt;/TD&gt;&lt;TD&gt;379&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _recv&lt;/TD&gt;&lt;TD&gt;C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\protocol.py&lt;/TD&gt;&lt;TD&gt;337&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; recv&lt;/TD&gt;&lt;TD&gt;C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\channel.py&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; read&lt;/TD&gt;&lt;TD&gt;C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\stream.py&lt;/TD&gt;&lt;TD&gt;166&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;exceptions.EOFError: [Errno 10054] An existing connection was forcibly closed by the remote host&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2015 19:15:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407072#M32058</guid>
      <dc:creator>CliveSwan</dc:creator>
      <dc:date>2015-12-29T19:15:01Z</dc:date>
    </item>
    <item>
      <title>Re:  outFeatureClass/arcpy.CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407073#M32059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SDE stuff... sorry, check your script logic on a local file if you can before you try to debug scripts loading from other connections.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2015 19:19:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407073#M32059</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-29T19:19:28Z</dc:date>
    </item>
    <item>
      <title>Re:  outFeatureClass/arcpy.CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407074#M32060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you may want to use the "Advanced Editor" in the upper right corner to edit your last reply (must have it open in a new Tab...not in the geonet inbox).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's have to tell is&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;#arcpy.DeleteFeatures_management(datadir + "\Bus Stops.shp")&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is an indentation error or not.&amp;nbsp;&amp;nbsp;&amp;nbsp; But my copy/paste was weird, so maybe might be the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would use&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;filetodelete = arcpy.os.path.join(datadir, "Bus Stops.shp")
arcpy.DeleteFeatures_Management(filetodelete)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;arcpy.DeleteFeatures_management(datadir + "\\Bus Stops.shp")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...notice double \\&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... also, you have a double&amp;nbsp;&amp;nbsp;&amp;nbsp; r"r"&amp;nbsp;&amp;nbsp; in&lt;/P&gt;&lt;P&gt;arcpy.DeleteFeatures_management(r"r"\\server1\\GISData\Highway_Layer_Update\Cluster_sites.shp")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:30:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/outfeatureclass-arcpy-copyfeatures-management/m-p/407074#M32060</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2021-12-11T18:30:58Z</dc:date>
    </item>
  </channel>
</rss>

