<?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: Why can't I import a python toolbox in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156440#M12060</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am going in a different direction now. Stumbled upon &lt;A href="https://community.esri.com/migrated-users/5701"&gt;Daniel Garcia&lt;/A&gt;‌'s answer in&amp;nbsp;&lt;A _jive_internal="true" href="https://community.esri.com/thread/54637"&gt;this thread&lt;/A&gt;. Which basically boils it down to this:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Develop your toolbox (with multiple tools)&lt;/LI&gt;&lt;LI&gt;Put the code a place the server can access it&lt;/LI&gt;&lt;LI&gt;Run the&amp;nbsp;&lt;A href="http://resources.arcgis.com/en/help/server-admin-api/createService.html"&gt;createService&lt;/A&gt;&amp;nbsp;on the ArcGIS Server using an adapted version of Daniel's json file.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;After the service has been published you can update the code, restart the service and your new code is active right away.&lt;/P&gt;&lt;P&gt;I'm not sure if there are any caveats yet. But it looks to me like a more developer friendly way of publishing geoprocessing services.&lt;/P&gt;&lt;P&gt;Now I easily can combine all my geoprocessing tools in one toolbox, and publish all at once.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Jul 2018 06:34:49 GMT</pubDate>
    <dc:creator>Robertvan_Gilst</dc:creator>
    <dc:date>2018-07-11T06:34:49Z</dc:date>
    <item>
      <title>Why can't I import a python toolbox</title>
      <link>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156433#M12053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using ArcGIS Desktop 10.6 and would like to publish my python toolboxes using&amp;nbsp;&lt;A href="http://pro.arcgis.com/en/pro-app/arcpy/functions/creategpsddraft.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Creategpsddraft&lt;/A&gt;&amp;nbsp;but I am running into problems in the very early stages. It cannot read my .pyt toolbox. I get the following error:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;STRONG&gt;IOError: The toolbox file d:/temp/Toolbox.pyt was not found.&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;I have tried it on two different computers with the same result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created the toolbox.pyt in ArcCatalog and haven't changed it.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;STRONG&gt;import arcpy&lt;/STRONG&gt;

&lt;STRONG&gt;toolbox = "d:/temp/Toolbox.pyt"&lt;/STRONG&gt;
&lt;STRONG&gt;# toolbox = "d:/temp/Toolbox1.tbx"&lt;/STRONG&gt;
&lt;STRONG&gt;arcpy.ImportToolbox(toolbox)&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;If I uncomment the line and import the tbx (which also is just a default toolbox) it works ok.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to&amp;nbsp;&lt;A _jive_internal="true" href="https://community.esri.com/thread/83465" target="_blank"&gt;this post&lt;/A&gt;&amp;nbsp;it should work just fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone please tell me what I am doing wrong!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:07:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156433#M12053</guid>
      <dc:creator>Robertvan_Gilst</dc:creator>
      <dc:date>2021-12-12T16:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I import a python toolbox</title>
      <link>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156434#M12054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;according to&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/arcpy/functions/addtoolbox.htm" title="http://pro.arcgis.com/en/pro-app/arcpy/functions/addtoolbox.htm"&gt;AddToolbox—ArcPy Functions | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;an alias is needed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2018 08:10:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156434#M12054</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-07-10T08:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I import a python toolbox</title>
      <link>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156435#M12055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried this both in the .pyt file:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;class Toolbox(object):
&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Define the toolbox (the name of the toolbox is the name of the
&amp;nbsp;&amp;nbsp;&amp;nbsp; .pyt file)."""
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.label = "Toolbox"
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.alias = "Toolbox"

&amp;nbsp;&amp;nbsp;&amp;nbsp; # List of tool classes associated with this toolbox
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.tools = [Tool]&lt;/PRE&gt;&lt;P&gt;And specifying it as the extra parameter in the ImportToolbox (or the AddToolbox) method. I still get the error that the file cannot be found.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:07:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156435#M12055</guid>
      <dc:creator>Robertvan_Gilst</dc:creator>
      <dc:date>2021-12-12T16:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I import a python toolbox</title>
      <link>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156436#M12056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;perhaps a different name than Toolbox... no clue now, other than that&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2018 08:30:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156436#M12056</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-07-10T08:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I import a python toolbox</title>
      <link>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156437#M12057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That doesn't help either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help anyway...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2018 08:43:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156437#M12057</guid>
      <dc:creator>Robertvan_Gilst</dc:creator>
      <dc:date>2018-07-10T08:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I import a python toolbox</title>
      <link>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156438#M12058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might use ArcCatalog to check the status of Toolbox.pyt.&amp;nbsp; It there is an error in the toolbox, indicated by a red x in the catalog icon, it&amp;nbsp;will give a "The toolbox file &amp;lt;Toolbox.pyt&amp;gt;&amp;nbsp;was not found" message even if the path to the file is valid.&amp;nbsp; You can right click in Catalog and "Check Syntax" of the tool.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jul 2018 17:06:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156438#M12058</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2018-07-10T17:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I import a python toolbox</title>
      <link>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156439#M12059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is a valid toolbox. Just the one generated in ArcCatalog. Haven't done anything with it .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2018 05:38:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156439#M12059</guid>
      <dc:creator>Robertvan_Gilst</dc:creator>
      <dc:date>2018-07-11T05:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I import a python toolbox</title>
      <link>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156440#M12060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am going in a different direction now. Stumbled upon &lt;A href="https://community.esri.com/migrated-users/5701"&gt;Daniel Garcia&lt;/A&gt;‌'s answer in&amp;nbsp;&lt;A _jive_internal="true" href="https://community.esri.com/thread/54637"&gt;this thread&lt;/A&gt;. Which basically boils it down to this:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Develop your toolbox (with multiple tools)&lt;/LI&gt;&lt;LI&gt;Put the code a place the server can access it&lt;/LI&gt;&lt;LI&gt;Run the&amp;nbsp;&lt;A href="http://resources.arcgis.com/en/help/server-admin-api/createService.html"&gt;createService&lt;/A&gt;&amp;nbsp;on the ArcGIS Server using an adapted version of Daniel's json file.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;After the service has been published you can update the code, restart the service and your new code is active right away.&lt;/P&gt;&lt;P&gt;I'm not sure if there are any caveats yet. But it looks to me like a more developer friendly way of publishing geoprocessing services.&lt;/P&gt;&lt;P&gt;Now I easily can combine all my geoprocessing tools in one toolbox, and publish all at once.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Robert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2018 06:34:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/why-can-t-i-import-a-python-toolbox/m-p/156440#M12060</guid>
      <dc:creator>Robertvan_Gilst</dc:creator>
      <dc:date>2018-07-11T06:34:49Z</dc:date>
    </item>
  </channel>
</rss>

