<?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: Model exported to python won't run - Includes IterateFieldValues and FC to FC in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/model-exported-to-python-won-t-run-includes/m-p/547874#M42760</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Unfortunately, this is not supported and is documented here: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Exporting_a_model/002w00000031000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Exporting_a_model/002w00000031000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The best solution is to call your model tool from a Python script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ImportToolbox(path to the toolbox contain the model tool)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ModelToolName(parameters)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 May 2011 17:16:17 GMT</pubDate>
    <dc:creator>JasonPardy</dc:creator>
    <dc:date>2011-05-24T17:16:17Z</dc:date>
    <item>
      <title>Model exported to python won't run - Includes IterateFieldValues and FC to FC</title>
      <link>https://community.esri.com/t5/python-questions/model-exported-to-python-won-t-run-includes/m-p/547871#M42757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I created three models and exported them to python hoping that I could create a batch file to auto-run them in sequence.&amp;nbsp; The first two are fine and work without a problem.&amp;nbsp; The third works properly as a model in ArcView but once exported as python script, won't run.&amp;nbsp; I haven't changed it at all and even tried re-exporting just in case.&amp;nbsp; (Well, it might be running but it's not producing anything.)&amp;nbsp; Any suggestions?&amp;nbsp; Is it possible that Iterate Field Values won't work outside of Arc?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import arcpy module&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Load required toolboxes&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ImportToolbox("Model Functions")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Local variables:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ProcessArea = "M:\\GISData\\CFNData\\FiberRoutes\\FiberSource\\ProcessArea"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;tblRouteSegments = "C:\\GISData\\FiberRoutes.mdb\\tblRouteSegments"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;tblActivePublicProviderList = "C:\\GISData\\FiberRoutes.mdb\\tblActivePublicProviderList"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Value = "1.shp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Iterate Field Values&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.IterateFieldValues_mb(tblActivePublicProviderList, "ProviderID", "String", "true", "true", "")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Feature Class to Feature Class&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.FeatureClassToFeatureClass_conversion(tblRouteSegments, ProcessArea, Value, [FieldMap...], "")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 May 2011 16:59:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/model-exported-to-python-won-t-run-includes/m-p/547871#M42757</guid>
      <dc:creator>SarahSullivan</dc:creator>
      <dc:date>2011-05-24T16:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: Model exported to python won't run - Includes IterateFieldValues and FC to FC</title>
      <link>https://community.esri.com/t5/python-questions/model-exported-to-python-won-t-run-includes/m-p/547872#M42758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Any model with an iterator will not correctly export to a script.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 May 2011 17:04:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/model-exported-to-python-won-t-run-includes/m-p/547872#M42758</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2011-05-24T17:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: Model exported to python won't run - Includes IterateFieldValues and FC to FC</title>
      <link>https://community.esri.com/t5/python-questions/model-exported-to-python-won-t-run-includes/m-p/547873#M42759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Why is that?&amp;nbsp; And is there a way to work around it?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 May 2011 17:05:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/model-exported-to-python-won-t-run-includes/m-p/547873#M42759</guid>
      <dc:creator>SarahSullivan</dc:creator>
      <dc:date>2011-05-24T17:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Model exported to python won't run - Includes IterateFieldValues and FC to FC</title>
      <link>https://community.esri.com/t5/python-questions/model-exported-to-python-won-t-run-includes/m-p/547874#M42760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Unfortunately, this is not supported and is documented here: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Exporting_a_model/002w00000031000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Exporting_a_model/002w00000031000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The best solution is to call your model tool from a Python script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ImportToolbox(path to the toolbox contain the model tool)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ModelToolName(parameters)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 May 2011 17:16:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/model-exported-to-python-won-t-run-includes/m-p/547874#M42760</guid>
      <dc:creator>JasonPardy</dc:creator>
      <dc:date>2011-05-24T17:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: Model exported to python won't run - Includes IterateFieldValues and FC to FC</title>
      <link>https://community.esri.com/t5/python-questions/model-exported-to-python-won-t-run-includes/m-p/547875#M42761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Unfortunately, this is not supported and is documented here: &lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Exporting_a_model/002w00000031000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Exporting_a_model/002w00000031000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The best solution is to call your model tool from a Python script:&lt;BR /&gt;&lt;BR /&gt;import arcpy&lt;BR /&gt;&lt;BR /&gt;arcpy.ImportToolbox(path to the toolbox contain the model tool)&lt;BR /&gt;&lt;BR /&gt;arcpy.ModelToolName(parameters)&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From Above Link -- &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If your model used any inline variable substitution such as %workspace%, %scratchworkspace%, %n%, %i%, or %variable name%, those will have to be substituted with the correct value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If your model used an iterator, the iteration logic will not be exported and will have to be replaced with the looping statements in Python.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't think the 'documentation' is very forthcoming on this.&amp;nbsp; It seems that when a model is exported to python that includes incompatible calls to arcpy functions arcgis should inert a comment in the python code explaining why it won't work, or trhow a warning when exporting such models.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you mean that putting the model that iterates a selection of attributes, in a saved toolbox, then importing the toolbox and the model will get around the limitation of using 'model only' tools in python?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2011 16:09:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/model-exported-to-python-won-t-run-includes/m-p/547875#M42761</guid>
      <dc:creator>MaxSquires</dc:creator>
      <dc:date>2011-06-28T16:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Model exported to python won't run - Includes IterateFieldValues and FC to FC</title>
      <link>https://community.esri.com/t5/python-questions/model-exported-to-python-won-t-run-includes/m-p/547876#M42762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes. If you import the toolbox using ImportToolbox and call the model you will get iteration.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2011 19:12:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/model-exported-to-python-won-t-run-includes/m-p/547876#M42762</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2011-06-28T19:12:28Z</dc:date>
    </item>
  </channel>
</rss>

