<?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: Hello, Large python scripts when embeded in a toolbox with a password take to long to extract and run.  In order to get around that I want to make an embedded password protected module of the part of the code that I want to protect.   in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/hello-large-python-scripts-when-embeded-in-a/m-p/99619#M7725</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the input.&amp;nbsp; But basically all I want to know is how to call an embedded script from another embedded script.&amp;nbsp; The final product will be a python ADD-IN.&amp;nbsp; I can call a script that is not embedded without a problem but cannot duplicate that for embedded scripts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Toolbox Script Not Embedded&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;# import ArcGis Geoprocessing module&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;import Script1B&lt;/P&gt;&lt;P&gt;arcpy.AddMessage(". . . Starting Script1A")&lt;/P&gt;&lt;P&gt;Script1B.printmessage()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Toolbox Script not Embedded in same location on C: drive&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Script&lt;/P&gt;&lt;P&gt;# import ArcGis Geoprocessing module&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;def printmessage():&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.AddMessage(". . . Starting Script1B")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output when running Script 1A&lt;/P&gt;&lt;P&gt;Executing: Script1A&lt;/P&gt;&lt;P&gt;Start Time: Tue Aug 09 08:45:47 2016&lt;/P&gt;&lt;P&gt;Running script Script1A...&lt;/P&gt;&lt;P&gt;. . . Starting Script1A&lt;/P&gt;&lt;P&gt;. . . Starting Script1B&lt;/P&gt;&lt;P&gt;Completed script Script1A...&lt;/P&gt;&lt;P&gt;Succeeded at Tue Aug 09 08:45:47 2016 (Elapsed Time: 0.04 seconds)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I first get everything working as it should from a toolbox and then embed all of the scripts.&amp;nbsp; Then when creating the python add-in I simply point the buttons at the toolbox scripts.&amp;nbsp; I just cannot get Script1A to call Script1B when both scripts are embedded (imported into the toolbox).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Aug 2016 14:48:38 GMT</pubDate>
    <dc:creator>DanielGreene</dc:creator>
    <dc:date>2016-08-09T14:48:38Z</dc:date>
    <item>
      <title>Hello, Large python scripts when embeded in a toolbox with a password take to long to extract and run.  In order to get around that I want to make an embedded password protected module of the part of the code that I want to protect.</title>
      <link>https://community.esri.com/t5/python-questions/hello-large-python-scripts-when-embeded-in-a/m-p/99617#M7723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the sample that I have been testing.&lt;/P&gt;&lt;P&gt;Script1A is embedded in the toolbox but not password protected&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SCRIPT1A&lt;/P&gt;&lt;P&gt;# import ArcGis Geoprocessing module&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;import os&lt;/P&gt;&lt;P&gt;relPath = os.path.dirname(__file__)&lt;/P&gt;&lt;P&gt;arcpy.AddMessage(relPath)&lt;/P&gt;&lt;P&gt;toolPath = relPath + r"\TestModulesEmbed.tbx"&lt;/P&gt;&lt;P&gt;arcpy.AddMessage(toolPath)&lt;/P&gt;&lt;P&gt;arcpy.AddMessage(". . . Starting Script1A")&lt;/P&gt;&lt;P&gt;# The tool is identified by the toolname and the toolbox alias&lt;/P&gt;&lt;P&gt;# Import the custom toolbox&lt;/P&gt;&lt;P&gt;arcpy.ImportToolbox(toolPath)&lt;/P&gt;&lt;P&gt;# Run the tool&lt;/P&gt;&lt;P&gt;arcpy.Script1B_TestModules&lt;/P&gt;&lt;P&gt;arcpy.TestModules.Script1B&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Script1B is embedded (imported) into the toolbox and also password protected&lt;/P&gt;&lt;P&gt;SCRIPT1B&lt;/P&gt;&lt;P&gt;# import ArcGis Geoprocessing module&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;import os&lt;/P&gt;&lt;P&gt;arcpy.AddMessage(". . . Script1B has been called")&lt;/P&gt;&lt;P&gt;def printmessage():&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.AddMessage(". . . Starting Script1B")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the result when running the code:&lt;/P&gt;&lt;P&gt;Executing: Script1A&lt;/P&gt;&lt;P&gt;Start Time: Sat Aug 06 09:52:10 2016&lt;/P&gt;&lt;P&gt;Running script Script1A...&lt;/P&gt;&lt;P&gt;C:\Data\NewContract\MyWork&lt;/P&gt;&lt;P&gt;C:\Data\NewContract\MyWork\TestModulesEmbed.tbx&lt;/P&gt;&lt;P&gt;. . . Starting Script1A&lt;/P&gt;&lt;P&gt;Completed script Script1A...&lt;/P&gt;&lt;P&gt;Succeeded at Sat Aug 06 09:52:10 2016 (Elapsed Time: 0.08 seconds)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideas of how to make this work will be appreciated.&amp;nbsp; I would like to protect the portion of the&lt;/P&gt;&lt;P&gt;script that accesses Oracle.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Aug 2016 15:57:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/hello-large-python-scripts-when-embeded-in-a/m-p/99617#M7723</guid>
      <dc:creator>DanielGreene</dc:creator>
      <dc:date>2016-08-06T15:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: Hello, Large python scripts when embeded in a toolbox with a password take to long to extract and run.  In order to get around that I want to make an embedded password protected module of the part of the code that I want to protect.</title>
      <link>https://community.esri.com/t5/python-questions/hello-large-python-scripts-when-embeded-in-a/m-p/99618#M7724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know if you have set this up as a package, but you can slow most down by just distributing the *.pyc files if you are doing imports of your base code.&amp;nbsp; The best protection is a license&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Aug 2016 00:33:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/hello-large-python-scripts-when-embeded-in-a/m-p/99618#M7724</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-08-07T00:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: Hello, Large python scripts when embeded in a toolbox with a password take to long to extract and run.  In order to get around that I want to make an embedded password protected module of the part of the code that I want to protect.</title>
      <link>https://community.esri.com/t5/python-questions/hello-large-python-scripts-when-embeded-in-a/m-p/99619#M7725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the input.&amp;nbsp; But basically all I want to know is how to call an embedded script from another embedded script.&amp;nbsp; The final product will be a python ADD-IN.&amp;nbsp; I can call a script that is not embedded without a problem but cannot duplicate that for embedded scripts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Toolbox Script Not Embedded&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;# import ArcGis Geoprocessing module&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;import Script1B&lt;/P&gt;&lt;P&gt;arcpy.AddMessage(". . . Starting Script1A")&lt;/P&gt;&lt;P&gt;Script1B.printmessage()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Toolbox Script not Embedded in same location on C: drive&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Script&lt;/P&gt;&lt;P&gt;# import ArcGis Geoprocessing module&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;def printmessage():&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.AddMessage(". . . Starting Script1B")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output when running Script 1A&lt;/P&gt;&lt;P&gt;Executing: Script1A&lt;/P&gt;&lt;P&gt;Start Time: Tue Aug 09 08:45:47 2016&lt;/P&gt;&lt;P&gt;Running script Script1A...&lt;/P&gt;&lt;P&gt;. . . Starting Script1A&lt;/P&gt;&lt;P&gt;. . . Starting Script1B&lt;/P&gt;&lt;P&gt;Completed script Script1A...&lt;/P&gt;&lt;P&gt;Succeeded at Tue Aug 09 08:45:47 2016 (Elapsed Time: 0.04 seconds)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I first get everything working as it should from a toolbox and then embed all of the scripts.&amp;nbsp; Then when creating the python add-in I simply point the buttons at the toolbox scripts.&amp;nbsp; I just cannot get Script1A to call Script1B when both scripts are embedded (imported into the toolbox).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Aug 2016 14:48:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/hello-large-python-scripts-when-embeded-in-a/m-p/99619#M7725</guid>
      <dc:creator>DanielGreene</dc:creator>
      <dc:date>2016-08-09T14:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Hello, Large python scripts when embeded in a toolbox with a password take to long to extract and run.  In order to get around that I want to make an embedded password protected module of the part of the code that I want to protect.</title>
      <link>https://community.esri.com/t5/python-questions/hello-large-python-scripts-when-embeded-in-a/m-p/99620#M7726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As it turns out my scripts embedded in a toolbox were working.&amp;nbsp; It is just that the arcpy.AddMessage tool does not work in a called script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SCRIPT1A IMPORTED IN A TOOLBOX&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="216915" alt="" class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/216915_Script1A.bmp" style="width: 594px; height: 697px;" /&gt;cr&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SCRIPT1B IMPORTED INTO A TOOLBOX AND PASSWORD PROTECTED&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="216914" alt="" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/216914_Script1B.bmp" style="width: 792px; height: 152px;" /&gt;&lt;/P&gt;&lt;P&gt;The output does create the TestDB.gdb&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Therefore, in order to get around the very slow time processing a large imported script in a toolbox the solution will be to put the portion I want to protect in it's own script so that the portion to decrypt when running the script will be small and fast.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit - I forgot the mention that the variable relPath passed from Script1A to Script1B needs to be defined for Script1B under properties, parameters:&lt;/P&gt;&lt;P&gt;Display Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Data Type&lt;/P&gt;&lt;P&gt;relPath&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; File&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Working with this more I ended up using the arcpy.RemoveToolbox(toolPath) command if it existed because if the old one had an error and you did not leave and restart ArcMap, it would still run the old one.&amp;nbsp; So, for multiple runs the called script is always refreshed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Aug 2016 15:48:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/hello-large-python-scripts-when-embeded-in-a/m-p/99620#M7726</guid>
      <dc:creator>DanielGreene</dc:creator>
      <dc:date>2016-08-18T15:48:45Z</dc:date>
    </item>
  </channel>
</rss>

