<?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: Joining Python Scripts outputs by using ModelBuilder  in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/joining-python-scripts-outputs-by-using/m-p/387595#M30625</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;is this the whole script? As Darren says your overwriting O_4 with O and then your overwriting "Warning" with "ERROR". What are each of the scripts trying to do? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 03 Apr 2016 13:59:04 GMT</pubDate>
    <dc:creator>WesMiller</dc:creator>
    <dc:date>2016-04-03T13:59:04Z</dc:date>
    <item>
      <title>Joining Python Scripts outputs by using ModelBuilder</title>
      <link>https://community.esri.com/t5/python-questions/joining-python-scripts-outputs-by-using/m-p/387592#M30622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I am new in python and have just started to write&amp;nbsp; some simple scripts similar to the following one:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;# Import arcpy module&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;import arcpy, os, sys&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;#Parameters&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;L= arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;O= arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;O_4= arcpy.GetParameterAsText(2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;#Variables&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;O_4= O&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;#Select by location&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;arcpy.SelectLayerByLocation_management(O, "WITHIN", L,"", "NEW_SELECTION", "")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;#Select by Attribute&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;arcpy.SelectLayerByAttribute_management(O_4, "SWITCH_SELECTION", "")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;#calculate field&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;arcpy.CalculateField_management(O, "Feild2", '"Warning"', "VB")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;#calculate field&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;arcpy.CalculateField_management(O_4, "Field2", '"ERROR"', "VB")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;When I attempt to join those scripts outputs (by using "Join" tool) &lt;/SPAN&gt;&lt;SPAN style="font-size: 16px;"&gt;in ModelBuilder; I &lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt;"&gt;get this error: &amp;lt;&amp;lt;Error:000229: Cannot pen \\psf\Home\Documents\Default.gdb\finaloutput ; Failed to execute (Merge)&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;I have also set my parameters as following:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;Display Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Data Type&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;&amp;nbsp; Type&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Direction&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;L&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Feature Layer&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; Required&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;&amp;nbsp; input&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;O&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Feature Layer&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; Required&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;&amp;nbsp; input&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;O_4&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Table&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Required&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;&amp;nbsp; output&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;Do you have any solution for that?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Apr 2016 22:36:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/joining-python-scripts-outputs-by-using/m-p/387592#M30622</guid>
      <dc:creator>FereshtehAghyan</dc:creator>
      <dc:date>2016-04-01T22:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: Joining Python Scripts outputs by using ModelBuilder</title>
      <link>https://community.esri.com/t5/python-questions/joining-python-scripts-outputs-by-using/m-p/387593#M30623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why do you bother asking for a parameter (O_4), if you're immediately going to overwrite it with "O"?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Apr 2016 22:48:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/joining-python-scripts-outputs-by-using/m-p/387593#M30623</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-04-01T22:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Joining Python Scripts outputs by using ModelBuilder</title>
      <link>https://community.esri.com/t5/python-questions/joining-python-scripts-outputs-by-using/m-p/387594#M30624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thats right! I am overwriting second "select by attribute" one by Calculate field , but should I keep it as a Parameter&amp;nbsp; and&amp;nbsp; variable (O_4) ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Apr 2016 23:16:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/joining-python-scripts-outputs-by-using/m-p/387594#M30624</guid>
      <dc:creator>FereshtehAghyan</dc:creator>
      <dc:date>2016-04-01T23:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: Joining Python Scripts outputs by using ModelBuilder</title>
      <link>https://community.esri.com/t5/python-questions/joining-python-scripts-outputs-by-using/m-p/387595#M30625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;is this the whole script? As Darren says your overwriting O_4 with O and then your overwriting "Warning" with "ERROR". What are each of the scripts trying to do? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Apr 2016 13:59:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/joining-python-scripts-outputs-by-using/m-p/387595#M30625</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2016-04-03T13:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Joining Python Scripts outputs by using ModelBuilder</title>
      <link>https://community.esri.com/t5/python-questions/joining-python-scripts-outputs-by-using/m-p/387596#M30626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fereshteh,&lt;/P&gt;&lt;P&gt;I have several suggestions and comments.&amp;nbsp; First, I agree with Darren and Wes that you do not need to ask for both "O" and "O_4" if they we be set the the same value right away.&amp;nbsp; Just ask for "0" and then include you next line if needed, but it may help to have more code (see my tips below).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Q: Since it looks like you are wanting to write it in arcpy/python, is there a reason you are trying to get this to work in ModelBuilder too?&amp;nbsp; Personally, when I was &lt;EM&gt;first&lt;/EM&gt; learning arcpy and it's syntax, I created a couple ModelBuilder tasks and then converted to python and then fixed the code the way I needed.&amp;nbsp; But that was not an efficient way for me, since there was so much "noise" I had to fix (but that was with ArcGIS 9.x, so may be better now).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With that said, when using python to select, you typically need to make it into a feature layer first.&amp;nbsp; See &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/select-layer-by-location.htm" title="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/select-layer-by-location.htm"&gt;Select Layer By Location—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp; for more explanation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tips for future posts. &lt;/P&gt;&lt;P&gt;- when posting code, look thru &lt;A href="https://community.esri.com/migration-blogpost/1070"&gt;Posting Code blocks in the new GeoNet&lt;/A&gt;​&lt;/P&gt;&lt;P&gt;- It takes a while to figure out the geonet structure, but&amp;nbsp; &lt;A href="https://community.esri.com/docs/DOC-1544"&gt;GeoNet Community Structure&lt;/A&gt;​&amp;nbsp; might help, and if needed you can move your post with &lt;A href="https://community.esri.com/docs/DOC-2258"&gt;Moving Content&lt;/A&gt; to the &lt;A href="https://community.esri.com/space/2087"&gt;Geoprocessing&lt;/A&gt;​&amp;nbsp;&amp;nbsp; or &lt;A href="https://community.esri.com/group/1218"&gt;Model Builder&lt;/A&gt;​&amp;nbsp; or &lt;A href="https://community.esri.com/space/2145"&gt;Python&lt;/A&gt;​&amp;nbsp; spaces to get a more focused set of responses. &lt;/P&gt;&lt;P&gt;- with me mentioning the other places with the @ and the location, that will automatically show a reference in those spaces.&amp;nbsp; That is the way to include other places without having to post it twice. (not that you did htat, but good to remember).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Apr 2016 17:58:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/joining-python-scripts-outputs-by-using/m-p/387596#M30626</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2016-04-03T17:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Joining Python Scripts outputs by using ModelBuilder</title>
      <link>https://community.esri.com/t5/python-questions/joining-python-scripts-outputs-by-using/m-p/387597#M30627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes that is a whole script. In this script, some features are supposed to be selected by "select by attribute" and select by location" then their two attribute table fields are supposed to be populated by"warning" and "error" values.&amp;nbsp; I will implant this and some other scripts (about 20-30) with similar functions in a model builder and the model builder&amp;nbsp; will join output of all those scripts.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Apr 2016 02:10:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/joining-python-scripts-outputs-by-using/m-p/387597#M30627</guid>
      <dc:creator>FereshtehAghyan</dc:creator>
      <dc:date>2016-04-04T02:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: Joining Python Scripts outputs by using ModelBuilder</title>
      <link>https://community.esri.com/t5/python-questions/joining-python-scripts-outputs-by-using/m-p/387598#M30628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rebecca,&lt;/P&gt;&lt;P&gt;As you, &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Darren and Wes suggested, I will replace all "O_4" with "O", I will also make feature layers from my source files, hopefully these suggestion solve the issue.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt; Since I am new in python I prefer to use ModelBuilder for doing "iterate" and "join" tasks. I have similar scripts to this one (about 20 scripts) which select some records in attribute table and their output are supposed to be join together In ModelBuilder.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Apr 2016 02:26:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/joining-python-scripts-outputs-by-using/m-p/387598#M30628</guid>
      <dc:creator>FereshtehAghyan</dc:creator>
      <dc:date>2016-04-04T02:26:55Z</dc:date>
    </item>
  </channel>
</rss>

