Select to view content in your preferred language

Problem running password-encrypted Python toolbox script / Problema al lanzar script Python de caja de herramientas encriptado con contraseña

2435
9
03-05-2019 02:22 AM
SilviaP
Emerging Contributor

Hello,

I have programmed a tool with Python (script) that I have added to an ArcGIS Desktop 10.1 toolbox. I wanted to share this script, but I do not want them to be able to see the script code or edit it, so after importing the script, I set a password. But when doing this, when I run the script, it does not work, ArcMap stays in the "Not Responding" state. Does anyone know what can be due
and how can I solve it?

 

Thank you!

-----------------------

Hola,

 

He programado una herramienta con Python (secuencia de comandos) que he agregado a una caja de herramientas de ArcGIS Desktop 10.1. 

 

Quería compartir este script, pero no quisiera que pudieran ver el código del script ni editarlo, por lo que, después de importar la secuencia de comandos, establezco una contraseña. Pero al realizar esto, cuando inicio el script, no funciona, ArcMap se queda en estado "No responde". ¿Alguien sabe a qué puede ser debido y cómo lo puedo solucionar?

 

Gracias!

 

Tags (3)
0 Kudos
9 Replies
TieshengWu
Regular Contributor

My suggestion is export your  script and to see whether it can work. Seems in some case the imported script become broken in ArcMap 10.1.

0 Kudos
SilviaP
Emerging Contributor
Thanks for your answer,  The exported script works correctly. The problem is that I have to import the script so that the company to which it is directed can not see the code of the script.  Do you know if there is another way to encrypt the code?
0 Kudos
TieshengWu
Regular Contributor

You can encrypt it to a .pyt file, but seems  there is software to crack  it.  So I use ArcMap 10.5 to import the script and save the toolbox as 10.1 format, and it work fine. 

SilviaP
Emerging Contributor

Than you so much! I'll try it!

0 Kudos
TieshengWu
Regular Contributor

Maybe your script is too large? If that, don't try to import the script. It will give your user a  bad using experience by the slow responding of the tool. Then the best way is  writing the toolbox as a pyt form  if your user can update his platform. 

SilviaP
Emerging Contributor

Exactly what happens, my script is too long and the response is bad, in fact it never runs. I have never writed a toolbox as a python toolbox, but I will try it. 

Why do you say "if your user can update his platform? The user works with ArcGIS Desktop 10.1 like me.

Thanks again!!

0 Kudos
SilviaP
Emerging Contributor

I already know why you say "if your user can update his platform? Because I only can encrypt by ArcGIS 10.5 not 10.1. Is there any way to save a .pyt toolbox in 10.1 after I write the toolbox in 10.5?

0 Kudos
TieshengWu
Regular Contributor

Yes we can encrypt a python toolbox and save it as a 10.1 one, but seems it will not run in 10.1, even opening the folder of the tool will make desktop to shut down in my machine.

The solution in 10.1 platform I think is:

1. Compile your .py as .pyc to avoid editing, but easy be decompiled.

2. How many lines is there in your script?  Import the script after optimizing your code, deleting  all of unneeded snippet, space lines and comments , then test if you can wait for it's response not  smashing your mouse.

3. Rewrite it in AO.

4. Tool license, It's the most effective protection. 

SilviaP
Emerging Contributor

I answer on your message:

1. Compile your .py as .pyc to avoid editing, but easy be decompiled.

As you say, it is easy to decompile the code. Simply by changing back .pyc by .py, so this solution does not work for me.

2. How many lines is there in your script?  Import the script after optimizing your code, deleting  all of unneeded snippet, space lines and comments , then test if you can wait for it's response not  smashing your mouse.

The code has 7954 lines. I have deleted the comments, spaces, etc. and I have managed to get the window that is launched when the tool runs, after 1 minute appears. But the parameters and the tool itself take a long time to complete the process.

3. Rewrite it in AO.

Do you mean Arc Objects? I had thought about creating an add-in...

4. Tool license, It's the most effective protection. 

I think that although I establish a control license, the user could take the code, which is what I try to avoid.

I thank you so much for your approach and that you dedicate your time in answering me. I do not know if I will achieve my objective, but your ideas help me a lot. Thanks again.

0 Kudos