<?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 Running a model from python script to use in Task Scheduler in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/running-a-model-from-python-script-to-use-in-task/m-p/47872#M3813</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Using examples from&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://blogs.esri.com/esri/arcgis/2011/06/24/exportmodeltopy/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://blogs.esri.com/esri/arcgis/2011/06/24/exportmodeltopy/&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;and&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://joelmccune.com/2011/05/05/run-models-as-scheduled-tasks/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://joelmccune.com/2011/05/05/run-models-as-scheduled-tasks/&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt; and posts from the forums here, I'm trying to run a model from modelbuilder to use in Task Manager.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The model works in ArcMap and the python code works in the python.exe interpreter when I run it and modifies the data in both cases.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is in Task Scheduler, when I run the scheduler it results as sucess but the feature layer and data is not being altered.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my python code to run model from the script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
arcpy.ImportToolbox("C:\\Users\\rh82134\\Documents\\ArcGIS\\Toolbox.tbx", "TBX")
arcpy.AFWtestauto_TBX()
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know my actions are set up right in Task Scheduler:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In progam/script I have C:\Python27\ArcGIS10.1\python.exe&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and the argument to the .py file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anybody help me with this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 21:50:55 GMT</pubDate>
    <dc:creator>RobertHupp</dc:creator>
    <dc:date>2021-12-10T21:50:55Z</dc:date>
    <item>
      <title>Running a model from python script to use in Task Scheduler</title>
      <link>https://community.esri.com/t5/python-questions/running-a-model-from-python-script-to-use-in-task/m-p/47872#M3813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Using examples from&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://blogs.esri.com/esri/arcgis/2011/06/24/exportmodeltopy/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://blogs.esri.com/esri/arcgis/2011/06/24/exportmodeltopy/&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;and&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://joelmccune.com/2011/05/05/run-models-as-scheduled-tasks/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://joelmccune.com/2011/05/05/run-models-as-scheduled-tasks/&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt; and posts from the forums here, I'm trying to run a model from modelbuilder to use in Task Manager.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The model works in ArcMap and the python code works in the python.exe interpreter when I run it and modifies the data in both cases.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is in Task Scheduler, when I run the scheduler it results as sucess but the feature layer and data is not being altered.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my python code to run model from the script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
arcpy.ImportToolbox("C:\\Users\\rh82134\\Documents\\ArcGIS\\Toolbox.tbx", "TBX")
arcpy.AFWtestauto_TBX()
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know my actions are set up right in Task Scheduler:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In progam/script I have C:\Python27\ArcGIS10.1\python.exe&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and the argument to the .py file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anybody help me with this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:50:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/running-a-model-from-python-script-to-use-in-task/m-p/47872#M3813</guid>
      <dc:creator>RobertHupp</dc:creator>
      <dc:date>2021-12-10T21:50:55Z</dc:date>
    </item>
  </channel>
</rss>

