Replies: 13 comments
-
Environment variable
|
Beta Was this translation helpful? Give feedback.
-
@jondy oh? I missed that, thank you! We'd rather not make it obvious that PyArmor is used. Any way to change the name of that, setting a env name of our choosing which would also be consistent with our env naming conventions? Maybe as a parameter while obfuscating the scripts? |
Beta Was this translation helpful? Give feedback.
-
In next major version 8.0+, the license.lic path could be specified by obfuscation option. |
Beta Was this translation helpful? Give feedback.
-
By obfuscation it would not be at runtime. I agree that at least it could be interesting to have a different name for PYARMOR_LICENSE. Or be able to set it's value at runtime for example in PyInstaller hook. |
Beta Was this translation helpful? Give feedback.
-
It's really not good UX to force my users to set this environment variable if they want to call my software from a different path. I might need to revert to an old PyArmor version because of that. |
Beta Was this translation helpful? Give feedback.
-
@jondy Please elaborate on what that means. Meaning that I would have to know in advance during the obfuscation the path to specify? In which case that doesn't solve it as the idea is to allow user at runtime to control the location. Or do you mean that during obfuscation I could specify the environment variable name -- in which case it would exactly solve my need.
|
Beta Was this translation helpful? Give feedback.
-
Actually for this case, there is a simple workaround and pyarmor need do nothing. Just add a few lines in the main script to copy for example, add code like this import pytransform
import shutil
licfile = '/path/to/license.lic' # get real path from command line
dest = os.path.dirname(pytransform.__file__)
shutil.copy(licfile, dest) |
Beta Was this translation helpful? Give feedback.
-
Thanks @jondy, thanks for that. In this case could it be possible to add this in the main script? The thing is when I try to add this code in main script its too late I gate the error could not find module about main script. |
Beta Was this translation helpful? Give feedback.
-
This solution may not work, I forget one thing: The obfuscated scripts could not be executed if there is no valid license found. |
Beta Was this translation helpful? Give feedback.
-
In my case I have added this in the pyinstaller runtime hook:
Setting environment variable in the runtime file does not work. What I don't understand is why I get the error if license.lic is in the same folder as the executable but I am running from a different folder. |
Beta Was this translation helpful? Give feedback.
-
The obfuscated scripts search
|
Beta Was this translation helpful? Give feedback.
-
Could it be possible to copy licence.lic to pytransform in the runtime hook like I did for sys._MEIPASS? |
Beta Was this translation helpful? Give feedback.
-
Refer to outer runtime key in Pyarmor 8.0+ |
Beta Was this translation helpful? Give feedback.
-
Unless I missed something, the only ability to have
license.lic
not in the same directory is using symbolic link as described here: https://pyarmor.readthedocs.io/en/latest/advanced.html#storing-runtime-file-license-lic-to-any-locationThis doesn't work in most cases for us. We distributed a binary made by pyinstaller for multiple operating systems and folks copy and move the binary around, with some Linux folks running it on a server that may have multiple people putting it in to their home folders. Often the Linux admin wants to put things in a shared folder, i.e.
/opt/acme/myapp
(both binary andlicense.lic
) and when the user runs from their home/home/userx
(i.e.linuxbox1:/home/userx$ /opt/acme/myapp
) it will complain it can't find the license. The admin doesn't want to allow symbolic links for the users.We'd like to be able to pass a command line switch to our app that can provide the path to where the
license.lic
file resides at runtime. Something like this:linuxbox1:/home/userx$ /opt/acme/myapp --license /opt/acme/license.lic --otherswitches
we would parse the command line args within the app and when we see
--license
we'd pass to some pyarmor API the path where to find thelicense.lic
file at runtime.Beta Was this translation helpful? Give feedback.
All reactions