<?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 Using Python to launch a model in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-python-to-launch-a-model/m-p/94123#M7345</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm new to using arcpy and I'm running into a few complications in getting a model to launch automatically using a python script. I've created the model, tested it, and it works perfectly. However, when I try to launch the model from python, it does not work. I've tried two methods. I've attached relevant documents. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) &lt;SPAN class="defaultSkin"&gt;&lt;SPAN class="j-attachment-name-chop"&gt;Model_ExecuteModelV5.py&lt;/SPAN&gt; contains the script used to import the toolbox, and run the model. (the model has no parameters). I've tested the script and I get the printed "Complete". However when I look at my results, the model did not run properly. In this case it did not identify any QC errors which the batch file in the model should have identified. Again, when I test the model within ArcGIS Desktop or Catalog, it works. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="defaultSkin"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="defaultSkin"&gt;2) &lt;SPAN class="defaultSkin"&gt;&lt;SPAN class="j-attachment-name-chop"&gt;Model_ExecuteModelV7.py contains the script with the exported model. I exported the model to a .py file and tested that within python. As a result &lt;/SPAN&gt;&lt;/SPAN&gt;I received an error saying: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="defaultSkin" style="color: #e23d39;"&gt;AttributeError: 'module' object has no attribute 'ExecuteReviewerBatchJob_Reviewer'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="defaultSkin" style="color: #303030;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="defaultSkin" style="color: #303030;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="defaultSkin" style="color: #303030;"&gt;Any support would be greatly appreciated. &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 May 2015 17:46:24 GMT</pubDate>
    <dc:creator>AnthonyBarron</dc:creator>
    <dc:date>2015-05-07T17:46:24Z</dc:date>
    <item>
      <title>Using Python to launch a model</title>
      <link>https://community.esri.com/t5/python-questions/using-python-to-launch-a-model/m-p/94123#M7345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm new to using arcpy and I'm running into a few complications in getting a model to launch automatically using a python script. I've created the model, tested it, and it works perfectly. However, when I try to launch the model from python, it does not work. I've tried two methods. I've attached relevant documents. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) &lt;SPAN class="defaultSkin"&gt;&lt;SPAN class="j-attachment-name-chop"&gt;Model_ExecuteModelV5.py&lt;/SPAN&gt; contains the script used to import the toolbox, and run the model. (the model has no parameters). I've tested the script and I get the printed "Complete". However when I look at my results, the model did not run properly. In this case it did not identify any QC errors which the batch file in the model should have identified. Again, when I test the model within ArcGIS Desktop or Catalog, it works. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="defaultSkin"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="defaultSkin"&gt;2) &lt;SPAN class="defaultSkin"&gt;&lt;SPAN class="j-attachment-name-chop"&gt;Model_ExecuteModelV7.py contains the script with the exported model. I exported the model to a .py file and tested that within python. As a result &lt;/SPAN&gt;&lt;/SPAN&gt;I received an error saying: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="defaultSkin" style="color: #e23d39;"&gt;AttributeError: 'module' object has no attribute 'ExecuteReviewerBatchJob_Reviewer'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="defaultSkin" style="color: #303030;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="defaultSkin" style="color: #303030;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="defaultSkin" style="color: #303030;"&gt;Any support would be greatly appreciated. &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 17:46:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-to-launch-a-model/m-p/94123#M7345</guid>
      <dc:creator>AnthonyBarron</dc:creator>
      <dc:date>2015-05-07T17:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to launch a model</title>
      <link>https://community.esri.com/t5/python-questions/using-python-to-launch-a-model/m-p/94124#M7346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My model also doesn't contain parameters.&amp;nbsp; I was able to get model builder to run through python.&amp;nbsp; From there I placed the python script in windows task scheduler.&amp;nbsp; Here is the link I found helpful&amp;nbsp; &lt;A href="http://blogs.esri.com/esri/arcgis/2013/07/30/scheduling-a-scrip/" title="http://blogs.esri.com/esri/arcgis/2013/07/30/scheduling-a-scrip/" rel="nofollow noopener noreferrer" target="_blank"&gt;Scheduling a Python script or model to run at a prescribed time | ArcGIS Blog&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below is the python code i used to reference in my model.&amp;nbsp; Most of the errors I encountered were from field calculators containing VB script.&amp;nbsp; I changed them all to python and it worked.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os
arcpy.env.overwriteOutput = True
arcpy.ImportToolbox(r"E:\GIS\Data\GIS\Dept\TechServices\MyNeighborhood\My Neighborhood.tbx")
arcpy.MyNeighbor_MyNeighborhoodtbx&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.04 I add the path to the toolbox copied from ArcCatalog&lt;/P&gt;&lt;P&gt;.05 call out the model name "MyNeighborhood" followed by an _ (must included the underscore) then call out the &lt;SPAN style="text-decoration: underline;"&gt;alias&lt;/SPAN&gt; name of the toolbox "MyNeighborhoodtbx"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:35:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-to-launch-a-model/m-p/94124#M7346</guid>
      <dc:creator>HeathAnderson</dc:creator>
      <dc:date>2021-12-10T23:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to launch a model</title>
      <link>https://community.esri.com/t5/python-questions/using-python-to-launch-a-model/m-p/94125#M7347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This topic is cross-posted &lt;A _jive_internal="true" href="https://community.esri.com/message/516614#516614"&gt;here&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 18:36:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-to-launch-a-model/m-p/94125#M7347</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-05-07T18:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to launch a model</title>
      <link>https://community.esri.com/t5/python-questions/using-python-to-launch-a-model/m-p/94126#M7348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Most of the errors I encountered were from field calculators containing VB script.&amp;nbsp; I changed them all to python and it worked.&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This is because Windows is set up to associate .py files with the last version of Python installed, in the case of ArcGIS Desktop, this usually&amp;nbsp; means the background processing 64 bit version of Python. So when you run a .py file from task scheduler it will always run x64 python unless you set it up otherwise by prefixing the python script name with &lt;SPAN style="font-family: 'courier new', courier;"&gt;C:\Python27\ArcGIS10.2\python.exe &lt;/SPAN&gt;to force it to run x32.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The default (VB) parser used by Calculate Field is not supported in arcpy x64. I have totally gotten into the habit of using the Python syntax so my scripts will run in x32 and x64.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2015 06:23:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-to-launch-a-model/m-p/94126#M7348</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2015-05-08T06:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to launch a model</title>
      <link>https://community.esri.com/t5/python-questions/using-python-to-launch-a-model/m-p/94127#M7349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Meta - FYI - to all - &lt;/P&gt;&lt;P&gt;The best method for cross - posting in Geonet is not to create another thread but to open the thread (by clicking its title) and using the Share button on the right side of the page.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 May 2015 04:39:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-to-launch-a-model/m-p/94127#M7349</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2015-05-12T04:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to launch a model</title>
      <link>https://community.esri.com/t5/python-questions/using-python-to-launch-a-model/m-p/94128#M7350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Curtis! &lt;BR /&gt;The script runs just fine now. I didn't even think about the 64-bit.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2015 14:09:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-to-launch-a-model/m-p/94128#M7350</guid>
      <dc:creator>AnthonyBarron</dc:creator>
      <dc:date>2015-05-13T14:09:23Z</dc:date>
    </item>
  </channel>
</rss>

