<?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: Run model from model builder in python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433800#M34088</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;oh! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well done Freddie, thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Jun 2016 14:31:24 GMT</pubDate>
    <dc:creator>GuillaumeGolay1</dc:creator>
    <dc:date>2016-06-24T14:31:24Z</dc:date>
    <item>
      <title>Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433780#M34068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Hi, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I've built a model with model builder. When I run it from model builder it works but now that i've exported it to python, it doesn't work...&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Here is my model:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Import arcpy module&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;import arcpy&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Load required toolboxes&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.ImportToolbox("C:/Users/w2sohi/Desktop/test/box.tbx","box")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Local variables:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;INTER = "C:\\Users\\w2sohi\\Desktop\\test\\INTER"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Process: Recréer le localisateur d’adresses&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.RebuildAddressLocator_box(INTER)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;It seems that there's a problem with: &lt;EM&gt;arcpy.ImportToolbox("C:/Users/w2sohi/Desktop/test/box.tbx","box")&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I have these error messages:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "C:\Users\w2sohi\Desktop\test\recreer.py", line 13, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ImportToolbox("C:/Users/w2sohi/Desktop/test/box.tbx","box")&lt;BR /&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\__init__.py", line 90, in ImportToolbox&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return import_toolbox(input_file, module_name)&lt;BR /&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\toolbox_code.py", line 441, in import_toolbox&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mymodule = generate_toolbox_module(toolbox, None, False, False, False, module_name, use_alt_alias)&lt;BR /&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\toolbox_code.py", line 399, in generate_toolbox_module&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; use_alt_alias))&lt;BR /&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\toolbox_code.py", line 391, in &amp;lt;genexpr&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; code = u"\n".join(line if isinstance(line, unicode)&lt;BR /&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\toolbox_code.py", line 311, in code_for_toolbox&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; yield "__all__ = %r" % ([str(tool.name) for tool in toolbox.tools],)&lt;BR /&gt;UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' in position 3: ordinal not in range(128)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thank you very much!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Guillaume&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2016 15:33:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433780#M34068</guid>
      <dc:creator>GuillaumeGolay1</dc:creator>
      <dc:date>2016-06-22T15:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433781#M34069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It has to do with the path. the &lt;EM&gt;slash u&lt;/EM&gt; is reserved to identify unicode characters so it's not interpreting your path correctly. Try changing all the path separators (slashes) to a back slash and put an &lt;SPAN style="font-family: 'courier new', courier;"&gt;r&lt;/SPAN&gt; in the front. Like this...&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14666101633922731" data-renderedposition="61_8_1106_16" jivemacro_uid="_14666101633922731"&gt;&lt;P&gt;r"C:\Users\w2sohi\Desktop\test\box.tbx"&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;Probably should do the same with your other paths.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Further reading on the subject. &lt;A href="https://community.esri.com/migration-blogpost/55463"&gt;Filenames and file paths in Python&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2016 15:43:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433781#M34069</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2016-06-22T15:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433782#M34070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Buuuuut, they had '/u' not '\u' which should be correct, correct?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2016 16:17:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433782#M34070</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-06-22T16:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433783#M34071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Guillaume,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do agree with Blake's advice on specifying the paths using the 'r'. It may also be useful to specify an alias name in your toolbox properties. I've found importing toolboxes is much more consistent that way. Then, you can ditch the second parameter. Good luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Micah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2016 16:22:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433783#M34071</guid>
      <dc:creator>MicahBabinski</dc:creator>
      <dc:date>2016-06-22T16:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433784#M34072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree. But from the looks of the error message, it's clearly saying there's a &lt;SPAN style="font-family: 'courier new', courier;"&gt;UnicodeEncodeError&lt;/SPAN&gt; on the line with the path name. I don't know what else it could be.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2016 16:22:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433784#M34072</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2016-06-22T16:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433785#M34073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What are the names of the tools in your toolbox? Looking at the error I'd assume that you're using characters in the name of your tools that are invalid ascii characters. According to the error you're using &lt;EM style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;u'\xe8', which should be equivalent to &lt;SPAN style="color: #1b277d; font-family: Roboto, Helvetica, Arial, sans-serif; font-size: 24.1164px; font-weight: bold; background-color: #f2f9ed;"&gt;è. &lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2016 21:29:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433785#M34073</guid>
      <dc:creator>FreddieGibson</dc:creator>
      <dc:date>2016-06-22T21:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433786#M34074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To elaborate on Freddie's comment&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; a = '\xe8' #, which should be equivalent to è.&amp;nbsp; # python 2.7
&amp;gt;&amp;gt;&amp;gt; a
'\xe8'
&amp;gt;&amp;gt;&amp;gt; print(a)


&amp;gt;&amp;gt;&amp;gt; a = '\xe8' #, which should be equivalent to è.&amp;nbsp; # python 3.5
&amp;gt;&amp;gt;&amp;gt; print(a)
è&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;compare line 5 (inviso line) to line 9&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Python versions above 3 enforce unicode,&amp;nbsp; python 2.7 doesn't unless you 'u' it&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:27:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433786#M34074</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T19:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433787#M34075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm thinking that their problem may be deeper than needing to make a string unicode. I would assume that if their tool contains unicode characters in the name it would run into a problem where Python 2.x does not support unicode identifiers. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.python.org/3.3/reference/lexical_analysis.html#identifiers" title="https://docs.python.org/3.3/reference/lexical_analysis.html#identifiers"&gt;https://docs.python.org/3.3/reference/lexical_analysis.html#identifiers&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;IMG alt="image3.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/208654_image3.png" style="width: 620px; height: 285px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Behind the scenes calling ImportToolbox wraps the tool within a class. This class uses the name of the tool for the name of the class (e.g. &lt;EM style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;arcpy.RebuildAddressLocator_box or arcpy.box.RebuildAddressLocator in the users code). If the name of the tool were something like RèbuildAddrèssLocator I'd assume you'd get the error they're seeing because you can't create an identifier in python 2 with this name.&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2016 22:29:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433787#M34075</guid>
      <dc:creator>FreddieGibson</dc:creator>
      <dc:date>2016-06-22T22:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433788#M34076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;that was the only thing that was confusing... the statement that everything worked in the model but not in python&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2016 22:47:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433788#M34076</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-22T22:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433789#M34077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Thank you all for helping me!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;So, I've changed the paths, following Blake's advise, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;add an alias "box" to my toolbox "box.tbx", following Micah's advise.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Now the code looks like this:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Import arcpy module&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;import arcpy&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Load required toolboxes&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.ImportToolbox(r"C:\Users\w2sohi\Desktop\test\box.tbx","box")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Local variables:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;INTER = "C:\\Users\\w2sohi\\Desktop\\test\\INTER"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Process: Recréer le localisateur d’adresses&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.RebuildAddressLocator_box(INTER)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;But, the error messages still remain the sames:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Traceback (most recent call last):&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; File "C:\Users\w2sohi\Desktop\test\recreer.py", line 13, in &amp;lt;module&amp;gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ImportToolbox(r"C:\Users\w2sohi\Desktop\test\box.tbx","box")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\__init__.py", line 90, in ImportToolbox&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return import_toolbox(input_file, module_name)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\toolbox_code.py", line 441, in import_toolbox&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mymodule = generate_toolbox_module(toolbox, None, False, False, False, module_name, use_alt_alias)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\toolbox_code.py", line 399, in generate_toolbox_module&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; use_alt_alias))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\toolbox_code.py", line 391, in &amp;lt;genexpr&amp;gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; code = u"\n".join(line if isinstance(line, unicode)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\toolbox_code.py", line 311, in code_for_toolbox&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; yield "__all__ = %r" % ([str(tool.name) for tool in toolbox.tools],)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' in position 3: ordinal not in range(128)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Freddie and Dan, the name of the tool is: &lt;EM&gt;RebuildAddressLocator&lt;/EM&gt;, Label is: &lt;EM&gt;Recréer le localisateur d'adresses&lt;/EM&gt; (as I live in the french part of Switrzerland). &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;So, in any case, I don't find any "è"... &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Is it possible that there's a problem with roots files as &lt;EM&gt;x86)\ArcGIS\Desktop10.1\arcpy\arcpy\toolbox_code.py&lt;/EM&gt; or &lt;EM&gt;x86)\ArcGIS\Desktop10.1\arcpy\arcpy\__init__.py &lt;/EM&gt;? (as they are mentionned in the error messages)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Also, I've tried to run the code with only:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Import arcpy module&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;import arcpy&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Load required toolboxes&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.ImportToolbox(r"C:\Users\w2sohi\Desktop\test\box.tbx","box")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;And also got the same error message. The problem seems to come from here...&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 06:37:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433789#M34077</guid>
      <dc:creator>GuillaumeGolay1</dc:creator>
      <dc:date>2016-06-23T06:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433790#M34078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you should post it, since there is no line 13 in the code you posted and the encoding error is &lt;EM&gt;u'\xe8' .&amp;nbsp; Also, do you have&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# coding: utf-8&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;as the first line of your scripts?&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 08:24:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433790#M34078</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-23T08:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433791#M34079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Dear Dan, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I modified my script like this:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Import arcpy module&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;import arcpy&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Local variables:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;INTER = "C:\\Users\\w2sohi\\Desktop\\test\\INTER"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Process: Recréer le localisateur d’adresses&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.RebuildAddressLocator_geocoding(INTER)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;And now it works! The problem came from &lt;EM&gt;arcpy.ImportToolbox &lt;/EM&gt;but I don't know exactly&amp;nbsp; what was happenning.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thank you very much for your help&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Guillaume&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 08:34:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433791#M34079</guid>
      <dc:creator>GuillaumeGolay1</dc:creator>
      <dc:date>2016-06-23T08:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433792#M34080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The syntax was wrong importing the toolbox:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;SPAN class="kn"&gt;&lt;/SPAN&gt;&lt;CODE&gt;&lt;SPAN class="kn"&gt;import&lt;/SPAN&gt; &lt;SPAN class="nn"&gt;arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="c"&gt;# Import custom toolbox&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="n"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;ImportToolbox&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="s"&gt;"c:/tools/My_Analysis_Tools.tbx"&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="k"&gt;try&lt;/SPAN&gt;&lt;SPAN class="p"&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="c"&gt;# Run tool in the custom toolbox.&amp;nbsp; The tool is identified by&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="c"&gt;#&amp;nbsp; the tool name and the toolbox alias.&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="n"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;GetPoints_myanalysis&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="s"&gt;"c:/data/forest.shp"&lt;/SPAN&gt;&lt;SPAN class="p"&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="k"&gt;except&lt;/SPAN&gt; &lt;SPAN class="n"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;ExecuteError&lt;/SPAN&gt;&lt;SPAN class="p"&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="k"&gt;print&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="n"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;GetMessages&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="mi"&gt;2&lt;/SPAN&gt;&lt;SPAN class="p"&gt;))&lt;/SPAN&gt;&lt;BR /&gt;&lt;/CODE&gt;from: &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//018v0000005z000000" title="http://resources.arcgis.com/en/help/main/10.2/index.html#//018v0000005z000000"&gt;ArcGIS Help (10.2, 10.2.1, and 10.2.2)&lt;/A&gt; &lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 20:33:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433792#M34080</guid>
      <dc:creator>DanielThomas1</dc:creator>
      <dc:date>2016-06-23T20:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433793#M34081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you explain what was wrong with the syntax?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 20:36:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433793#M34081</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-06-23T20:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433794#M34082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Easier to call the toolbox and then run the tool (that is in the imported toolbox) by name as shown&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 20:40:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433794#M34082</guid>
      <dc:creator>DanielThomas1</dc:creator>
      <dc:date>2016-06-23T20:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433795#M34083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: 0.2em; font-size: 16px; font-family: arial, helvetica, sans-serif; color: #000000;"&gt;Well, the help seems to indicate that you can do it either way, but perhaps it's wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2 style="margin-bottom: 0.2em; font-size: 16px; font-family: arial, helvetica, sans-serif; color: #000000;"&gt;Syntax&lt;/H2&gt;&lt;P style="margin: 0 0 0.3em; font-size: 12.8px; color: #4d4d4d; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;SPAN style="font-size: 12.8px;"&gt;&lt;STRONG&gt;ImportToolbox (input_file, {module_name})&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="arcpyclass_mparams" style="margin: 0 0 0.3em; font-size: 12.8px; color: #4d4d4d; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;/P&gt;&lt;TABLE class="arcpyclass_paramtbl" style="margin: 0 0 0 15px; border: 1px solid #c2c4ba; font-size: 12.16px;"&gt;&lt;TBODY style="font-size: 12.16px;"&gt;&lt;TR style="border: 0px; font-size: 12.16px;"&gt;&lt;TD class="th_p" style="padding: 5px; border: 1px solid #c2c4ba; font-size: 12.16px; font-weight: bold; color: #000000; background: #e2e2e2;"&gt;Parameter&lt;/TD&gt;&lt;TD class="th_e" style="padding: 5px; border: 1px solid #c2c4ba; font-size: 12.16px; font-weight: bold; color: #000000; background: #e2e2e2;"&gt;Explanation&lt;/TD&gt;&lt;TD class="th_d" style="padding: 5px; border: 1px solid #c2c4ba; font-size: 12.16px; font-weight: bold; color: #000000; background: #e2e2e2;"&gt;Data Type&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-size: 12.16px;"&gt;&lt;TD style="padding: 2px 5px 0; border: 1px solid #c2c4ba; font-size: 12.16px;"&gt;&lt;DIV style="margin: 0 0 0.3em; font-size: 12.16px;"&gt;input_file&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;TD style="padding: 2px 5px 0; border: 1px solid #c2c4ba; font-size: 12.16px;"&gt;&lt;P style="margin-top: 0.5em; margin-bottom: 0.5em; margin-left: 10px; padding-bottom: 2px; font-size: 12.16px;"&gt;The geoprocessing toolbox added to the ArcPy site package.&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 2px 5px 0; border: 1px solid #c2c4ba; font-size: 12.16px;"&gt;String&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-size: 12.16px;"&gt;&lt;TD style="padding: 2px 5px 0; border: 1px solid #c2c4ba; font-size: 12.16px;"&gt;&lt;P style="margin: 0 0 0.3em; font-size: 12.16px;"&gt;module_name&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 2px 5px 0; border: 1px solid #c2c4ba; font-size: 12.16px;"&gt;&lt;P style="margin-top: 0.5em; margin-bottom: 0.5em; margin-left: 10px; padding-bottom: 2px; font-size: 12.16px;"&gt;If the toolbox does not have an alias, the &lt;SPAN class="usertext" style="font-size: 12.16px; font-family: 'Courier New', Courier, monospace;"&gt;module_name&lt;/SPAN&gt; is required.&lt;/P&gt;&lt;P style="margin-top: 0.5em; margin-bottom: 0.5em; margin-left: 10px; padding-bottom: 2px; font-size: 12.16px;"&gt;When a tool is accessed through the ArcPy site package, the toolbox alias where the tool is contained is a required suffix (&lt;SPAN class="usertext" style="font-size: 12.16px; font-family: 'Courier New', Courier, monospace;"&gt;arcpy.&amp;lt;toolname&amp;gt;_&amp;lt;alias&amp;gt;&lt;/SPAN&gt;). Since ArcPy depends on toolbox aliases to access and execute the correct tool, aliases are extremely important when importing custom toolboxes. A good practice is to always define a custom toolbox's alias; however, if the toolbox alias is not defined, a temporary alias can be set as the second parameter.&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 2px 5px 0; border: 1px solid #c2c4ba; font-size: 12.16px;"&gt;String&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 20:51:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433795#M34083</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-06-23T20:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433796#M34084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you upload your toolbox so I can take a look at it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 21:36:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433796#M34084</guid>
      <dc:creator>FreddieGibson</dc:creator>
      <dc:date>2016-06-23T21:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433797#M34085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.dropbox.com/sh/bpqovfez211nmyo/AAC5ks6YwP50dz1N19oBFwVea?dl=0" title="https://www.dropbox.com/sh/bpqovfez211nmyo/AAC5ks6YwP50dz1N19oBFwVea?dl=0"&gt;Dropbox - locator_python&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's a copy of the folder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for helping me! (Just have to say to you that i solved my problem but i'm interesting about understanding why).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My solution was:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Import arcpy module&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;import arcpy&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Local variables:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;INTER = "C:\\Users\\w2sohi\\Desktop\\test\\INTER"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Process: Recréer le localisateur d’adresses&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.RebuildAddressLocator_geocoding(INTER)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So not calling the toolbox, and replace &lt;EM&gt;RebuildAddressLocator_box(INTER)&lt;/EM&gt; with &lt;EM&gt;RebuildAddressLocator_geocoding(INTER)&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2016 07:21:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433797#M34085</guid>
      <dc:creator>GuillaumeGolay1</dc:creator>
      <dc:date>2016-06-24T07:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433798#M34086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So it looks like you have a system tool and a model in your toolbox. The problem is that the model within your toolbox is named &lt;STRONG&gt;"Modèle"&lt;/STRONG&gt;. When you call ImportToolbox this will cause a conflict because identifiers in python 2.X don't support using he character &lt;STRONG&gt;è&lt;/STRONG&gt;. If you remove the è the toolbox imports just fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2016-06-24_6-24-54.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/208908_2016-06-24_6-24-54.png" style="width: 620px; height: 421px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2016 14:01:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433798#M34086</guid>
      <dc:creator>FreddieGibson</dc:creator>
      <dc:date>2016-06-24T14:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Run model from model builder in python</title>
      <link>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433799#M34087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Darren,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The documentation in this case would be correct. When you build a custom toolbox you are required to call ImportToolbox to load the toolbox. Think of this like when you create a custom class in python. You are require to call import to load the module into your project. When you import the toolbox you have two choices. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Import the toolbox with just the file path. In this case the alias for the toolbox will be the alias assigned in the toolbox's properties.&lt;/LI&gt;&lt;LI&gt;Import the toolbox along and specify an alias name. This would allow you to specify a unique alias for your toolbox on the fly. &lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A lot of people forget to specify the alias within the toolbox properties. As such, they leverage the second option to ensure that the name of their toolbox is unique. For example, let's say that you called your tool Clip. There are currently two clip tools included with the base install of ArcGIS (i.e. Clip_analysis and Clip_management). Without specifying an alias the system wouldn't necessarily know which version of the clip function you're wanting. As such, you could specify an alias in the import of the tool, such as box, so that the system can easily identify that you can to use the Clip_box tool as opposed to other tools with the same name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason why Guillame was able to get their code change to work is because they changed their code to leverage the system tool that is automatically loaded by arcpy. If they were to dig further into the system they would see that this particular toolbox uses "geocoding" as the alias and doesn't contain any invalid tool/model/script tool names.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2016 14:18:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/run-model-from-model-builder-in-python/m-p/433799#M34087</guid>
      <dc:creator>FreddieGibson</dc:creator>
      <dc:date>2016-06-24T14:18:06Z</dc:date>
    </item>
  </channel>
</rss>

