<?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: 10.1 arcpy.CopyFeatures_management fails when using joined inputs in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/10-1-arcpy-copyfeatures-management-fails-when/m-p/70558#M2514</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Turns out it was a simple fix. I added:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;output_str = str (output)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;after making my new gdb to convert it to a string. This (I think?) allows it to be read by other commands down the line.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jul 2013 12:50:38 GMT</pubDate>
    <dc:creator>JonathanCusick</dc:creator>
    <dc:date>2013-07-10T12:50:38Z</dc:date>
    <item>
      <title>10.1 arcpy.CopyFeatures_management fails when using joined inputs</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/10-1-arcpy-copyfeatures-management-fails-when/m-p/70553#M2509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Scenario:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-fresh File Geodatabase created using ArcCatalog 10.1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-one feature class in FGDB;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-one table in the same FGDB;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-make a feature layer from feature class;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-make a table view from table;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-add join using feature layer and tableview as inputs, KEEP_COMMON;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-execute copyfeatures to write new featureclass into the same FGDB and preserve joined data in output;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This works (sometimes) in modelbuilder but doesnt work in a standalone python script. It doesn't seem to matter if join columns are indexed or not.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this a known defect and if so, is it going to be fixed soon as I have dozens of scripts that use this workflow that work just fine in earlier releases?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 19:35:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/10-1-arcpy-copyfeatures-management-fails-when/m-p/70553#M2509</guid>
      <dc:creator>MarkWilloughby</dc:creator>
      <dc:date>2012-10-11T19:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: 10.1 arcpy.CopyFeatures_management fails when using joined inputs</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/10-1-arcpy-copyfeatures-management-fails-when/m-p/70554#M2510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I cannot reproduce it in 10.1. I can test if you can share your data (or part of data).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os

wks = os.getcwd()
arcpy.env.workspace = os.path.join(wks, "joins.gdb")

in_fc = "states_few"
in_id = "geocompID"
join_table = "table1"
join_id = "ID"
join_type = "KEEP_COMMON"

try:

&amp;nbsp;&amp;nbsp;&amp;nbsp; # note the output layer name is states_layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; # use this output layer in subsequent tools
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(in_fc, "states_layer")

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddJoin_management("states_layer", in_id, join_table, join_id, join_type)

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management("states_layer", "states_joined")

&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages()

except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages(2)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:42:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/10-1-arcpy-copyfeatures-management-fails-when/m-p/70554#M2510</guid>
      <dc:creator>NobbirAhmed</dc:creator>
      <dc:date>2021-12-10T22:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: 10.1 arcpy.CopyFeatures_management fails when using joined inputs</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/10-1-arcpy-copyfeatures-management-fails-when/m-p/70555#M2511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try to add the intermediate step of exporting the joined file to a new one and see if it fails as well&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Oct 2012 22:15:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/10-1-arcpy-copyfeatures-management-fails-when/m-p/70555#M2511</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2012-10-31T22:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: 10.1 arcpy.CopyFeatures_management fails when using joined inputs</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/10-1-arcpy-copyfeatures-management-fails-when/m-p/70556#M2512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Fails for me every time in a script, but not interactively. A complete pain.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Even if I run it successfully interactively, copy-as-python-snippet and repeat in a script it fails to populate the joined fields.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There is no error message, just blank (not null) fields.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Running 10.0 SP5 but a test on 10.1 SP1 had the same result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My (terrible) workaround is to create a dictionary of the joined feature content, add the fields and then run an updatecursor with the dictionary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alternatively I just open the results the next month and run it again while I surf the net watching the election.....&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Nov 2012 08:49:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/10-1-arcpy-copyfeatures-management-fails-when/m-p/70556#M2512</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2012-11-08T08:49:13Z</dc:date>
    </item>
    <item>
      <title>Re: 10.1 arcpy.CopyFeatures_management fails when using joined inputs</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/10-1-arcpy-copyfeatures-management-fails-when/m-p/70557#M2513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I feel like I'm missing something obvious, but I'm having trouble with the CopyFeatures_management command as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My script creates a new file gdb into which I would then like to copy feature classes. The script works fine when I define the name of the new gdb ahead of time within the code, but I'd rather have the name generated using GetParametersAsText to make the script more interactive. I'm very new to python so I don't know if I'm I just formatting my CopyFeatures command wrong? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As of now I get TypeError: unsupported operand type (s) for +: 'Result' and 'str'&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 12:10:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/10-1-arcpy-copyfeatures-management-fails-when/m-p/70557#M2513</guid>
      <dc:creator>JonathanCusick</dc:creator>
      <dc:date>2013-07-10T12:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: 10.1 arcpy.CopyFeatures_management fails when using joined inputs</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/10-1-arcpy-copyfeatures-management-fails-when/m-p/70558#M2514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Turns out it was a simple fix. I added:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;output_str = str (output)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;after making my new gdb to convert it to a string. This (I think?) allows it to be read by other commands down the line.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 12:50:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/10-1-arcpy-copyfeatures-management-fails-when/m-p/70558#M2514</guid>
      <dc:creator>JonathanCusick</dc:creator>
      <dc:date>2013-07-10T12:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: 10.1 arcpy.CopyFeatures_management fails when using joined inputs</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/10-1-arcpy-copyfeatures-management-fails-when/m-p/70559#M2515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The '+' operand works when both are string (or of same type). Your output is an object of type 'Result'. When you converted it to a str your code worked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A better practice is to call getOutput to get the whole path of the geodatabase:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;output.getOutput(0)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 15:51:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/10-1-arcpy-copyfeatures-management-fails-when/m-p/70559#M2515</guid>
      <dc:creator>NobbirAhmed</dc:creator>
      <dc:date>2013-07-10T15:51:12Z</dc:date>
    </item>
  </channel>
</rss>

