<?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: Running a model with py script errors  in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/running-a-model-with-py-script-errors/m-p/828321#M1267</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the response Dan, where do I find the documentation? Sorry I'm kind of a newbie.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Aug 2019 20:56:00 GMT</pubDate>
    <dc:creator>DavidMaack</dc:creator>
    <dc:date>2019-08-21T20:56:00Z</dc:date>
    <item>
      <title>Running a model with py script errors</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/running-a-model-with-py-script-errors/m-p/828319#M1265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone, I am trying to automate a model I have built in Arcpro. I have looked at other posts with similar issues, but can't seem to fix it or figure out what I'm doing wrong. Please help &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;The model takes a CSV, creates points (customers) then draws a line from point to point according to the matching xy in each customer. It also creates another point file with another CSV file. Heres what it looks like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image" height="320" src="https://community.esri.com/legacyfs/online/457613_model.PNG" width="579" /&gt;&lt;/P&gt;&lt;P&gt;Using online resouces I created a script to automate the running of this model because it needs to be updated every day, however I get an error that the model has no atribute. I have tried calling it as "arcpy.automate.Model_() and without the underscore as well ("_")&amp;nbsp; I am using spyder IDLE to run the code, it doesnt seem to work in the ArcPro python window either.&lt;/P&gt;&lt;P&gt;Heres the code:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import arcpy

arcpy.env.workspace=("C://Users/Planner1/Documents/ArcGIS/Projects/Automate_links_round2/Automate_links_round2.gdb")
arcpy.env.overwriteOutput = False

print ('Script started')
# import the toolbox
arcpy.ImportToolbox(r"C:/Users/Planner1/Documents/ArcGIS/Projects/Automate_links_round2/Automate.tbx")
print ('Toolbox imported')

#import the model
arcpy.automate.Model()
print ('Model imported')
print ('Script finished')&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And here is the metadata for the tool:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji jive-image image-2 j-img-original" src="https://community.esri.com/legacyfs/online/457614_Metadata.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;runfile('C:/Users/Planner1/Documents/KML_Codes/Schedule Model builder.py', wdir='C:/Users/Planner1/Documents/KML_Codes')
Script started
Toolbox imported
Traceback (most recent call last):

  File "&amp;lt;ipython-input-6-a3a2d3d140f5&amp;gt;", line 1, in &amp;lt;module&amp;gt;
    runfile('C:/Users/Planner1/Documents/KML_Codes/Schedule Model builder.py', wdir='C:/Users/Planner1/Documents/KML_Codes')

  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)

  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/Planner1/Documents/KML_Codes/Schedule Model builder.py", line 19, in &amp;lt;module&amp;gt;
    arcpy.Model()

AttributeError: module 'arcpy' has no attribute 'Model'&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if I need to add any more info to help answer this question.&lt;/P&gt;&lt;P&gt;Thanks for the help,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:59:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/running-a-model-with-py-script-errors/m-p/828319#M1265</guid>
      <dc:creator>DavidMaack</dc:creator>
      <dc:date>2021-12-12T09:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Running a model with py script errors</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/running-a-model-with-py-script-errors/m-p/828320#M1266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;link to the documentation you are using since it doesn't even register in arcpy for Pro 2.4?&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt; dir&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;automate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
Traceback &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;most recent call last&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;

  File &lt;SPAN class="string token"&gt;"&amp;lt;ipython-input-3-3922f2da4268&amp;gt;"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;module&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
    dir&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;automate&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

AttributeError&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; module &lt;SPAN class="string token"&gt;'arcpy'&lt;/SPAN&gt; has no attribute &lt;SPAN class="string token"&gt;'automate'&lt;/SPAN&gt;




dir&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Model&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
Traceback &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;most recent call last&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;

  File &lt;SPAN class="string token"&gt;"&amp;lt;ipython-input-4-79fd79a0764b&amp;gt;"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;module&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
    dir&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Model&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

AttributeError&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; module &lt;SPAN class="string token"&gt;'arcpy'&lt;/SPAN&gt; has no attribute &lt;SPAN class="string token"&gt;'Model'&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:59:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/running-a-model-with-py-script-errors/m-p/828320#M1266</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T09:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Running a model with py script errors</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/running-a-model-with-py-script-errors/m-p/828321#M1267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the response Dan, where do I find the documentation? Sorry I'm kind of a newbie.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Aug 2019 20:56:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/running-a-model-with-py-script-errors/m-p/828321#M1267</guid>
      <dc:creator>DavidMaack</dc:creator>
      <dc:date>2019-08-21T20:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Running a model with py script errors</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/running-a-model-with-py-script-errors/m-p/828322#M1268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;David … it is this line ….&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f2f0; color: #000000; font-family: monospace; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;arcpy.automate.Model()&lt;/SPAN&gt; .&amp;nbsp; When I import arcpy and do a dir(arcpy.automate) it produces an error, so where does this line come from?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Aug 2019 21:11:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/running-a-model-with-py-script-errors/m-p/828322#M1268</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-08-21T21:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Running a model with py script errors</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/running-a-model-with-py-script-errors/m-p/828323#M1269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ohh, sorry Dan. automate is the toolbox and Model() is the model name. I am going off of what ESRI has on their site.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/help/analysis/geoprocessing/modelbuilder/scheduling-a-model-run.htm" title="https://pro.arcgis.com/en/pro-app/help/analysis/geoprocessing/modelbuilder/scheduling-a-model-run.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Schedule a model—ArcGIS Pro | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import arcpy
arcpy.ImportToolbox(r"C:\path\myToolbox.tbx", "tbxAlias")
arcpy.myModel_tbxAlias(r"c:\pathToInput\inputFolder", r"C:\pathToGdb\output.gdb")&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:59:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/running-a-model-with-py-script-errors/m-p/828323#M1269</guid>
      <dc:creator>DavidMaack</dc:creator>
      <dc:date>2021-12-12T09:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: Running a model with py script errors</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/running-a-model-with-py-script-errors/m-p/828324#M1270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok.. makes more sense now.&amp;nbsp; You might want to provide the 'alias' for the toolbox.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your model is named "Model" and your toolbox is named "Automate"&lt;/P&gt;&lt;P&gt;you should be able to...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f2f0; color: #000000; font-family: monospace; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;arcpy.ImportToolbox(r"C:/Users/Planner1/Documents/ArcGIS/Projects/Automate_links_round2/Automate.tbx, 'autostuff'"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f2f0; color: #000000; font-family: monospace; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f5f2f0; color: #000000; font-family: monospace; font-size: 100%; font-style: inherit; font-variant: normal; font-weight: inherit; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;arcpy.Model_autostuff or arcpy.autostuff.Model&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Aug 2019 21:41:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/running-a-model-with-py-script-errors/m-p/828324#M1270</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-08-21T21:41:25Z</dc:date>
    </item>
  </channel>
</rss>

