<?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: copy features error in python and not modelbuilder in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/copy-features-error-in-python-and-not-modelbuilder/m-p/447762#M35114</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;When using Python, a single backslash is known as an &lt;A href="http://docs.python.org/release/2.5.2/ref/strings.html" target="_blank"&gt;escape character&lt;/A&gt;.&amp;nbsp; &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also see:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/01m1/01m10000000s000000.htm"&gt;ArcGIS Desktop 10.2 Help: Paths explained: Absolute, Relative, UNC&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//002z0000000r000000"&gt;ArcGIS Desktop 10.2 Help: Setting paths to data in Python&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Sep 2013 13:04:21 GMT</pubDate>
    <dc:creator>curtvprice</dc:creator>
    <dc:date>2013-09-25T13:04:21Z</dc:date>
    <item>
      <title>copy features error in python and not modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/copy-features-error-in-python-and-not-modelbuilder/m-p/447760#M35112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="plain" name="code"&gt; import arcpy from arcpy import env arcpy.env.overwriteOutput = True arcpy.CopyFeatures_management("U:\GIS_Data\Geodatabase\TEST_2.mdb\lines\other_line", "U:\TEST_2.gdb\lines\other_line") &amp;nbsp; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Runtime error&amp;nbsp; Traceback (most recent call last):&amp;nbsp;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 2227, in CopyFeatures&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Input Features: Dataset U:\GIS_Data\Geodatabase\TEST_2.mdb\lines\other_line does not exist or is not supported WARNING 000725: Output Feature Class: Dataset U:\TEST_2.gdb\lines\other_line already exists. Failed to execute (CopyFeatures).&amp;nbsp; &lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried taking out the underscores. Geoprocessing options are set to overwrite as well. The biggest issue is the line that does not exist/not supported&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Sep 2013 23:31:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-features-error-in-python-and-not-modelbuilder/m-p/447760#M35112</guid>
      <dc:creator>AmyKlug</dc:creator>
      <dc:date>2013-09-24T23:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: copy features error in python and not modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/copy-features-error-in-python-and-not-modelbuilder/m-p/447761#M35113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&lt;SPAN&gt;When using Python, a single backslash is known as an &lt;A href="&amp;lt;/span&amp;gt;&amp;lt;a" target="_blank"&gt;escape" rel="nofollow" target="_blank"&amp;gt;http://docs.python.org/release/2.5.2/ref/strings.html]escape&lt;/A&gt;&lt;SPAN&gt; character. Therefore, to use a backslash you must use a double backslash or use the raw string method. So for your paths you can supply them one of 3 ways:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; # double backslash line = "U:\\GIS_Data\\Geodatabase\\TEST_2.mdb\\lines\\other_line"&amp;nbsp; # raw string (easiest method) line = r"U:\GIS_Data\Geodatabase\TEST_2.mdb\lines\other_line"&amp;nbsp; # forward slash line = "U:/GIS_Data/Geodatabase/TEST_2.mdb/lines/other_line"&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The second option is the easiest in my opinion. Try changing your code to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy arcpy.env.overwriteOutput = True&amp;nbsp; # variables original = r"U:\GIS_Data\Geodatabase\TEST_2.mdb\lines\other_line" copy = r"U:\TEST_2.gdb\lines\other_line"&amp;nbsp; # explicitly delete output if it exists if arcpy.Exists(copy): &amp;nbsp;&amp;nbsp; arcpy.Delete_management(copy)&amp;nbsp; # copy features tool arcpy.CopyFeatures_management(original, copy) &amp;nbsp; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a quick example to show you how some escape characters work. The '\n' is the new line character, and the '\t' is a tab. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;gt;&amp;gt;&amp;gt; test = 'C:\Data\new_folder\tables\Schools.dbf' &amp;gt;&amp;gt;&amp;gt; print test C:\Data ew_folder ables\Schools.dbf &amp;gt;&amp;gt;&amp;gt; test = r'C:\Data\new_folder\tables\Schools.dbf' &amp;gt;&amp;gt;&amp;gt; print test C:\Data\new_folder\tables\Schools.dbf &amp;gt;&amp;gt;&amp;gt; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;Also, I just took another look at your error messages...Did you install the &lt;A href="&amp;lt;/span&amp;gt;&amp;lt;a" target="_blank"&gt;64" rel="nofollow" target="_blank"&amp;gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//002100000040000000]64&lt;/A&gt;&lt;SPAN&gt; bit background processing? If so, your Python may be defaulting to the 64 bit Python version, which does not support Personal geodatabases. Otherwise, you could try &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;STRONG&gt;explicitly&lt;/STRONG&gt;&lt;SPAN&gt; deleting the output if it exists.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Sep 2013 00:31:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-features-error-in-python-and-not-modelbuilder/m-p/447761#M35113</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-09-25T00:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: copy features error in python and not modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/copy-features-error-in-python-and-not-modelbuilder/m-p/447762#M35114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;When using Python, a single backslash is known as an &lt;A href="http://docs.python.org/release/2.5.2/ref/strings.html" target="_blank"&gt;escape character&lt;/A&gt;.&amp;nbsp; &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also see:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/01m1/01m10000000s000000.htm"&gt;ArcGIS Desktop 10.2 Help: Paths explained: Absolute, Relative, UNC&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//002z0000000r000000"&gt;ArcGIS Desktop 10.2 Help: Setting paths to data in Python&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Sep 2013 13:04:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-features-error-in-python-and-not-modelbuilder/m-p/447762#M35114</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2013-09-25T13:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: copy features error in python and not modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/copy-features-error-in-python-and-not-modelbuilder/m-p/447763#M35115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; When using Python, a single backslash is known as an &lt;A href="http://docs.python.org/release/2.5.2/ref/strings.html" target="_blank" rel="nofollow noopener noreferrer"&gt;escape character&lt;/A&gt;. Therefore, to use a backslash you must use a double backslash or use the raw string method. So for your paths you can supply them one of 3 ways:&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt; &lt;PRE class="lia-code-sample line-numbers language-none"&gt;

# double backslash
line = "U:\\GIS_Data\\Geodatabase\\TEST_2.mdb\\lines\\other_line"

# raw string (easiest method)
line = r"U:\GIS_Data\Geodatabase\TEST_2.mdb\lines\other_line"

# forward slash
line = "U:/GIS_Data/Geodatabase/TEST_2.mdb/lines/other_line"
&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;The second option is the easiest in my opinion. Try changing your code to:&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt; &lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
arcpy.env.overwriteOutput = True

# variables
original = &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;r&lt;/SPAN&gt;"U:\GIS_Data\Geodatabase\TEST_2.mdb\lines\other_line"
copy = &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;r&lt;/SPAN&gt;"U:\TEST_2.gdb\lines\other_line"

# explicitly delete output if it exists
if arcpy.Exists(copy):
&amp;nbsp;&amp;nbsp; arcpy.Delete_management(copy)

# copy features tool
arcpy.CopyFeatures_management(original, copy)
&amp;nbsp; 
&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;Here is a quick example to show you how some escape characters work. The '\n' is the new line character, and the '\t' is a tab.&amp;nbsp;&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt; &lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt; test = 'C:\Data\new_folder\tables\Schools.dbf'
&amp;gt;&amp;gt;&amp;gt; print test
C:\Data
ew_folder ables\Schools.dbf
&amp;gt;&amp;gt;&amp;gt; test = r'C:\Data\new_folder\tables\Schools.dbf'
&amp;gt;&amp;gt;&amp;gt; print test
C:\Data\new_folder\tables\Schools.dbf
&amp;gt;&amp;gt;&amp;gt; &lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;Also, I just took another look at your error messages...Did you install the &lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//002100000040000000" target="_blank" rel="nofollow noopener noreferrer"&gt;64 bit background processing?&lt;/A&gt; If so, your Python may be defaulting to the 64 bit Python version, which does not support Personal geodatabases. Otherwise, you could try&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;explicitly&lt;/STRONG&gt; deleting the output if it exists.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yeah, I tried all that yesterday and again today after I read this just to be sure and same result. scratching head&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also exported the model as python code. the model runs fine, the code doesn't! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I copied the .gdb into the folder with the .mdb and did a copy in the python window and it worked (copied from .gdb to .gdb). something is wrong with the mdb when used with python. But it works as a model, I can also copy it manually&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also made sure the files were not read-only&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ideas? I am trying to run this as a scheduled task or else I would just use the model.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT: Didn't read the bottom of you post.......I am running 10.1 with SP1 and did switch to the 64 bit processing. It's always something &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:00:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-features-error-in-python-and-not-modelbuilder/m-p/447763#M35115</guid>
      <dc:creator>AmyKlug</dc:creator>
      <dc:date>2021-12-11T20:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: copy features error in python and not modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/copy-features-error-in-python-and-not-modelbuilder/m-p/447764#M35116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What kind of machine are you running the scheduled task from (e.g. Windows Server 2008, Windows XP, Windows 7)?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Sep 2013 18:46:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-features-error-in-python-and-not-modelbuilder/m-p/447764#M35116</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-09-25T18:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: copy features error in python and not modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/copy-features-error-in-python-and-not-modelbuilder/m-p/447765#M35117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;EDIT: Didn't read the bottom of you post.......I am running 10.1 with SP1 and did switch to the 64 bit processing. It's always something &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok, since you have the 64 bit python you need to force it to run 32 bit python.&amp;nbsp; You can set up a simple batch file like this to run 32 bit:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
start C:\Python27\ArcGIS10.1\python.exe&amp;nbsp; G:\PROJECTS\Cedar\GeneralScripts\PyLibrary\FormattedExcel.py
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I usually create files like this in notepad and save it with a .bat file extension&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;note the path for python.exe:&amp;nbsp; C:\Python27\&lt;/SPAN&gt;&lt;STRONG&gt;ArcGIS10.1&lt;/STRONG&gt;&lt;SPAN&gt;\python.exe&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The path for the 64 bit is:&amp;nbsp; C:\Python27\&lt;/SPAN&gt;&lt;STRONG&gt;ArcGISx6410.2&lt;/STRONG&gt;&lt;SPAN&gt;\python.exe&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;64 bit has the "x64" in the folder name.&amp;nbsp; Make sure you use 32 bit python when working with personal GDB's, coverages, excel files, etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can always see what version you are running by typing this in the python shell:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import sys

print sys.version&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For my 64 bit, it prints:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)]&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For my 32 bit it prints:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:00:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-features-error-in-python-and-not-modelbuilder/m-p/447765#M35117</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T20:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: copy features error in python and not modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/copy-features-error-in-python-and-not-modelbuilder/m-p/447766#M35118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It didn't work the first few times but seems to be working now (after I changed the output folder once again write/read) with the batch file set to 32, great tip. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I checked my version it says I'm using 32 bit (2.7.2). go figure?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT: It still doesn't run in the python window&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT2: I went to geoprocessing options and disabled background processing and now it works in python window too.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Sep 2013 21:14:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-features-error-in-python-and-not-modelbuilder/m-p/447766#M35118</guid>
      <dc:creator>AmyKlug</dc:creator>
      <dc:date>2013-09-25T21:14:21Z</dc:date>
    </item>
  </channel>
</rss>

