<?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: My script for schedule a model run fails ??? in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/my-script-for-schedule-a-model-run-fails/m-p/417706#M14106</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Duncan&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thx, but this is not my favorit area, so i'm still a bit lost &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;I gave my toolbox an alias as "AUTO" and my script looks like this now (the model i want to call is named "Test" and is working as a stand alone model):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import sys, os, arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ImportToolbox(r"x:\MB_Svenne\AutoRun.tbx")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.Test_AUTO()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But the result in IDLE is still the same ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Mar 2012 06:22:35 GMT</pubDate>
    <dc:creator>HenrikSvenningsen</dc:creator>
    <dc:date>2012-03-14T06:22:35Z</dc:date>
    <item>
      <title>My script for schedule a model run fails ???</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/my-script-for-schedule-a-model-run-fails/m-p/417704#M14104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;My script to call a model:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import sys, os, arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ImportToolbox(r"x:\MB_Svenne\AutoRun.tbx", "TBX")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.Test_TBX()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;The answer from IDLE:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "X:/MB_Svenne/AUTORUN1", line 5, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Test_TBX()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AttributeError: 'module' object has no attribute 'Test_TBX'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PLEASE HELP i havn't a clue :confused:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 11:52:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/my-script-for-schedule-a-model-run-fails/m-p/417704#M14104</guid>
      <dc:creator>HenrikSvenningsen</dc:creator>
      <dc:date>2012-03-13T11:52:51Z</dc:date>
    </item>
    <item>
      <title>An idea?</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/my-script-for-schedule-a-model-run-fails/m-p/417705#M14105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Henrik,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;According to Help:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The best practice is to assign an alias when first creating the toolbox rather than using ImportToolbox to assign a temporary one that will only be applicable in Python.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So give your toolbox an alias and drop the "TBX" from:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.ImportToolbox(r"x:\MB_Svenne\AutoRun.tbx", "TBX")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Duncan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 19:25:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/my-script-for-schedule-a-model-run-fails/m-p/417705#M14105</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2012-03-13T19:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: My script for schedule a model run fails ???</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/my-script-for-schedule-a-model-run-fails/m-p/417706#M14106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Duncan&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thx, but this is not my favorit area, so i'm still a bit lost &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;I gave my toolbox an alias as "AUTO" and my script looks like this now (the model i want to call is named "Test" and is working as a stand alone model):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import sys, os, arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ImportToolbox(r"x:\MB_Svenne\AutoRun.tbx")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.Test_AUTO()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But the result in IDLE is still the same ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2012 06:22:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/my-script-for-schedule-a-model-run-fails/m-p/417706#M14106</guid>
      <dc:creator>HenrikSvenningsen</dc:creator>
      <dc:date>2012-03-14T06:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: My script for schedule a model run fails ???</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/my-script-for-schedule-a-model-run-fails/m-p/417707#M14107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Henrik,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are you getting the same error message? Unless it's top secret could you zip up your model and upload it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just to make sure I understand you have a model in a toolbox and you are trying to execute it from IDLE with the code you have posted on this thread?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Duncan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2012 09:00:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/my-script-for-schedule-a-model-run-fails/m-p/417707#M14107</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2012-03-14T09:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: My script for schedule a model run fails ???</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/my-script-for-schedule-a-model-run-fails/m-p/417708#M14108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Duncan&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think it may be my model and due to that there is Parametre in it. I just made a simple "Clip Model" and it works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Basicly i want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;Schedule Windows 7 to run a py script&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;The py script to start a model&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Model to run in night time.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Result to be ready when i meet in to work&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;BR /&gt;&lt;SPAN&gt;I should not be ana "hokus pokus" with the script from above in my first mail, or ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2012 10:18:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/my-script-for-schedule-a-model-run-fails/m-p/417708#M14108</guid>
      <dc:creator>HenrikSvenningsen</dc:creator>
      <dc:date>2012-03-14T10:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: My script for schedule a model run fails ???</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/my-script-for-schedule-a-model-run-fails/m-p/417709#M14109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Henrik,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If your model takes a parameter (e.g. a polygon FeatureClass that is the clip polygon for a clip tool) and this will never change then you could unset this parameter as it never changes. So your model is a model without parameters. This is how your original python script was calling the model&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&lt;SPAN style="color:#006400;"&gt;# Calls a model called Test (with no parameters) in a toolbox with the Alias set to AUTO
&lt;/SPAN&gt;arcpy.Test_AUTO()
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If your model has an input exposed as an input parameter then you will need to supply this. It's important that paramerers are supplied in the order as they are defined in the model properties (parameters tab).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color:#006400;"&gt;# Calls a model called Test (with 1 parameter) in a toolbox with the Alias set to AUTO
&lt;/SPAN&gt;arcpy.Test_AUTO(r"c:\temp\clipPoly.shp") &lt;SPAN style="color:#006400;"&gt;
&lt;/SPAN&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You should not assume your model will always run without error so you should make your code smarter by looking at the result object the model returns and deal with an error accordingly&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;resObj = arcpy.Test_AUTO(r"c:\temp\clipPoly.shp")
if resObj.status == 4:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "success!"
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "failure :(" &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:53:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/my-script-for-schedule-a-model-run-fails/m-p/417709#M14109</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2021-12-11T18:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: My script for schedule a model run fails ???</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/my-script-for-schedule-a-model-run-fails/m-p/417710#M14110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a lot Duncan &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; it's running now.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2012 11:28:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/my-script-for-schedule-a-model-run-fails/m-p/417710#M14110</guid>
      <dc:creator>HenrikSvenningsen</dc:creator>
      <dc:date>2012-03-14T11:28:33Z</dc:date>
    </item>
  </channel>
</rss>

