<?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 Modify all Script File Paths in Custom Toolbox? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/modify-all-script-file-paths-in-custom-toolbox/m-p/124041#M9645</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a custom toolbox called "Micahs_tools.tbx" which I have built up over a couple of years:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="101274" class="image-1 jive-image" height="385" src="https://community.esri.com/legacyfs/online/101274_pastedImage_0.png" style="width: 262px; height: 384.610837438424px;" width="262" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The toolbox contains 94 tools. Initially I saved the source Python scripts in a network location, but for various reasons I have moved the directory which contains the scripts to a local drive. Now I'm wondering if there's a Python way to get at the paths to those scripts and change them to reflect the new location of the scripts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this possible, and how would it be accomplished?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Micah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 May 2015 20:44:25 GMT</pubDate>
    <dc:creator>MicahBabinski</dc:creator>
    <dc:date>2015-05-18T20:44:25Z</dc:date>
    <item>
      <title>Modify all Script File Paths in Custom Toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/modify-all-script-file-paths-in-custom-toolbox/m-p/124041#M9645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a custom toolbox called "Micahs_tools.tbx" which I have built up over a couple of years:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="101274" class="image-1 jive-image" height="385" src="https://community.esri.com/legacyfs/online/101274_pastedImage_0.png" style="width: 262px; height: 384.610837438424px;" width="262" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The toolbox contains 94 tools. Initially I saved the source Python scripts in a network location, but for various reasons I have moved the directory which contains the scripts to a local drive. Now I'm wondering if there's a Python way to get at the paths to those scripts and change them to reflect the new location of the scripts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this possible, and how would it be accomplished?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Micah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2015 20:44:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/modify-all-script-file-paths-in-custom-toolbox/m-p/124041#M9645</guid>
      <dc:creator>MicahBabinski</dc:creator>
      <dc:date>2015-05-18T20:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Modify all Script File Paths in Custom Toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/modify-all-script-file-paths-in-custom-toolbox/m-p/124042#M9646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Was the toolbox originally located on the same disk as the scripts? &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/creating-tools/adding-a-script-tool.htm"&gt;Relative paths&lt;/A&gt; make this process transparent, i.e. you can move the scripts and the toolbox together and the paths will resolve automatically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/sharing-workflows/embedding-scripts-and-password-protecting-tools.htm"&gt;embed (import) scripts into the tbx file &lt;/A&gt;- &lt;STRONG&gt;&lt;EM&gt;if&lt;/EM&gt; &lt;/STRONG&gt;the paths are correct when you do it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2015 05:18:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/modify-all-script-file-paths-in-custom-toolbox/m-p/124042#M9646</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2015-05-19T05:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Modify all Script File Paths in Custom Toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/modify-all-script-file-paths-in-custom-toolbox/m-p/124043#M9647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alas, no, the scripts were saved on a network share and the .tbx is on my C drive. Does that mean it can't be done?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2015 14:56:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/modify-all-script-file-paths-in-custom-toolbox/m-p/124043#M9647</guid>
      <dc:creator>MicahBabinski</dc:creator>
      <dc:date>2015-05-19T14:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Modify all Script File Paths in Custom Toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/modify-all-script-file-paths-in-custom-toolbox/m-p/124044#M9648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think you can get to the raw code in a tbx file.&amp;nbsp; You might, however, be able to convert the tbx to a pyt using the following tool: &lt;A href="http://www.arcgis.com/home/item.html?id=83585412edd04ae48bdffea3e1f7b2e7" title="http://www.arcgis.com/home/item.html?id=83585412edd04ae48bdffea3e1f7b2e7"&gt;http://www.arcgis.com/home/item.html?id=83585412edd04ae48bdffea3e1f7b2e7&lt;/A&gt;.&amp;nbsp; I haven't tried it, so I'm not sure what complexity it will introduce.&amp;nbsp; Once the tool is in the pyt, updating the scripts paths should be relatively simple.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2015 16:11:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/modify-all-script-file-paths-in-custom-toolbox/m-p/124044#M9648</guid>
      <dc:creator>BillDaigle</dc:creator>
      <dc:date>2015-05-19T16:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Modify all Script File Paths in Custom Toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/modify-all-script-file-paths-in-custom-toolbox/m-p/124045#M9649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No it can't be done -- they are binary files that you cannot access in Python. If you&amp;nbsp; look there is text embedded in the tbx file, but that's just the metadata - tool documentation (XML code).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only way to do this is to go through and update the script paths one by one for your 94 tools. If you go to relative paths [or embed the scripts in the tbx, or do Bill's suggestion to make a pyt], from here on out you will never have to do it again. Personally I like leaving the scripts outside the toolbox where I can easily edit them.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2015 18:26:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/modify-all-script-file-paths-in-custom-toolbox/m-p/124045#M9649</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2015-05-19T18:26:03Z</dc:date>
    </item>
  </channel>
</rss>

