pyarmor icon indicating copy to clipboard operation
pyarmor copied to clipboard

[BUG] `[Errno 2] No such file or directory: '.pyarmor/pack/PYZ-00.pyz_extracted/pyarmor_runtime_005695/__init__.pyc'`

Open printpal-io opened this issue 1 year ago • 3 comments

I am trying to pack my script and protect the runtime memory as specified here: https://pyarmor.readthedocs.io/en/latest/how-to/protection.html#

I am using the following command:

pyarmor -d gen --mix-str --assert-call --assert-import --private --pack dist/main/main main.py

In my directory that has the original structure (before calling pyinstaller main.py):

/src
  main.py
  pw/
    script1.py 
    ...
    scriptN.py

I get the following error:

DEBUG    call post runtime plugin <class 'pyarmor.cli.plugin.CodesignPlugin'>
INFO     generate runtime files OK
INFO     start to obfuscate scripts
INFO     process resource "main"
INFO     obfuscating file main.py
DEBUG    process inline marker
DEBUG    parse script
DEBUG    process assert.call
DEBUG    process assert.import
DEBUG    process mix.str
DEBUG    process co
DEBUG    patch co
INFO     write .pyarmor/pack/dist/main.py
INFO     obfuscate scripts OK
INFO     repacking bundle "dist/main/main"
INFO     obfuscated scripts at "dist"
INFO     entry script name is "main.py"
DEBUG    runtime package at dist/pyarmor_runtime_005695
INFO     repacking "PYZ-00.pyz"
DEBUG    unknown error, please check pyarmor.error.log
ERROR    [Errno 2] No such file or directory: '.pyarmor/pack/PYZ-00.pyz_extracted/pyarmor_runtime_005695/__init__.pyc'
ERROR    something is wrong

printpal-io avatar May 02 '24 22:05 printpal-io

This bug will be fixed in next version.

Please use pyarmor gen --pack onedir ... directly, I have update this section https://pyarmor.readthedocs.io/en/latest/how-to/protection.html

jondy avatar May 03 '24 03:05 jondy

This bug will be fixed in next version.

Please use pyarmor gen --pack onedir ... directly, I have update this section https://pyarmor.readthedocs.io/en/latest/how-to/protection.html

Using this new documentation and the packing works, but when trying to run the packed executable I get the following error:

File "PyInstaller/loader/pyimod03_importers.py", line 495, in exec_module
  File "pyarmor_runtime_005695/__init__.py", line 2, in <module>
RuntimeError: this license key is not for this machine (1:10332)

My license shows as valid (pro version).

printpal-io avatar May 03 '24 04:05 printpal-io

Do not obfuscate pyarmor_runtime_005695/__init__.py

And Pyarmor license is only used for pyarmor gen, not for running obfuscated scripts.

I suggest reading the topic understanding obfuscated scripts

jondy avatar May 04 '24 02:05 jondy