[BUG] invalid license token, try to run `pyarmor reg` to register license again with pro license in docker ctainer
MichalDN opened this issue · comments
Hello, I cannot make head nor tails of this, we purchased a pro license, I subsequently made a docker file like this (it is expected to be run less than 100 times a day):
suggested 'run pyarmor reg' if run ahead of gen does not help
# Start from the manylinux2014_x86_64 base image
FROM quay.io/pypa/manylinux2014_x86_64
# Set the working directory in the container to /ops
WORKDIR /tmp
# Copy the local zip file to the container
COPY pyarmor-regfile-xxxx.zip /tmp/
# Register pyarmor using the zip file
RUN /opt/python/cp39-cp39/bin/python -m venv venv && \
source venv/bin/activate && \
pip install pyarmor && \
pyarmor reg /tmp/pyarmor-regfile-xxxx.zip && \
deactivate && \
rm -rf venv
RUN rm /tmp/*
It worked for ... I guess a day or two, but after the weekend it started throwing invalid license token error
The weird thing is, that if I rerun the command three times it seems to recover, but I cannot really depend on this workaround. Is this a bug or expected? How should I proceed? I guess I could register the license during every run, but that seems excessive.
pyarmor -v
Pyarmor 8.5.7 (pro), 00XXXX, clarity-studio
License Type : pyarmor-pro
License No. : pyarmor-vax-00xxxx
License To : xxxxxxxxxxxxxxxxxxxxxxxxxxxx
License Product : clarity-studio
BCC Mode : Yes
RFT Mode : Yes
Notes
* Need verify license online when obfuscating scripts
pyarmor reg -g 1
INFO Python 3.9.19
INFO Pyarmor 8.5.7 (pro), 00xxx, clarity-studio
INFO Platform linux.x86_64
INFO generating device file ".pyarmor/group/pyarmor-group-device.1"
INFO current machine id is "mb2d0131fd32d54f24b967d128acd68c8"
INFO device file has been generated successfully
error log
(venv) [root@f5b858cf77e7 tmp]# cat pyarmor.error.log
24 MainProcess 2024-04-29 11:03:05,017
Traceback (most recent call last):
File "/tmp/venv/lib/python3.9/site-packages/pyarmor/cli/__main__.py", line 769, in main
main_entry(sys.argv[1:])
File "/tmp/venv/lib/python3.9/site-packages/pyarmor/cli/__main__.py", line 757, in main_entry
return args.func(ctx, args)
File "/tmp/venv/lib/python3.9/site-packages/pyarmor/cli/__main__.py", line 249, in cmd_gen
builder.process(options)
File "/tmp/venv/lib/python3.9/site-packages/pyarmor/cli/generate.py", line 167, in process
Pytransform3.pre_build(self.ctx)
File "/tmp/venv/lib/python3.9/site-packages/pyarmor/cli/core/__init__.py", line 120, in pre_build
m = Pytransform3.init(ctx)
File "/tmp/venv/lib/python3.9/site-packages/pyarmor/cli/core/__init__.py", line 100, in init
m.init_ctx(ctx)
RuntimeError: invalid license token, try to run `pyarmor reg` to register license again
bug report
(venv) [root@f5b858cf77e7 tmp]# cat pyarmor.report.bug
[Bug] RuntimeError: invalid license token, try to run `pyarmor reg` to register license again
### Full command options and console output
/tmp/venv/bin/pyarmor -d gen test.py
2024-04-29 11:03:04,960 Python 3.9.19
2024-04-29 11:03:04,960 Pyarmor 8.5.7 (pro), 00xxxx, clarity-studio
2024-04-29 11:03:04,962 Platform linux.x86_64
2024-04-29 11:03:04,962 native platform linux.x86_64
2024-04-29 11:03:04,962 home path: /root/.pyarmor
2024-04-29 11:03:04,962 command options: {'no_runtime': False, 'inputs': ['test.py']}
2024-04-29 11:03:04,963 install plugin: CodesignPlugin
2024-04-29 11:03:04,963 install plugin: DarwinUniversalPlugin
2024-04-29 11:03:04,963 search inputs ...
2024-04-29 11:03:04,963 find script test.py
2024-04-29 11:03:04,963 find 1 top resources
2024-04-29 11:03:05,016 unknown error, please check pyarmor.error.log
2024-04-29 11:03:05,017 invalid license token, try to run `pyarmor reg` to register license again
### Traceback
Traceback (most recent call last):
File "/tmp/venv/lib/python3.9/site-packages/pyarmor/cli/__main__.py", line 769, in main
main_entry(sys.argv[1:])
File "/tmp/venv/lib/python3.9/site-packages/pyarmor/cli/__main__.py", line 757, in main_entry
return args.func(ctx, args)
File "/tmp/venv/lib/python3.9/site-packages/pyarmor/cli/__main__.py", line 249, in cmd_gen
builder.process(options)
File "/tmp/venv/lib/python3.9/site-packages/pyarmor/cli/generate.py", line 167, in process
Pytransform3.pre_build(self.ctx)
File "/tmp/venv/lib/python3.9/site-packages/pyarmor/cli/core/__init__.py", line 120, in pre_build
m = Pytransform3.init(ctx)
File "/tmp/venv/lib/python3.9/site-packages/pyarmor/cli/core/__init__.py", line 100, in init
m.init_ctx(ctx)
RuntimeError: invalid license token, try to run `pyarmor reg` to register license again
Steps to reproduce with -d
(venv) XXXXXXX:~/pyclarity_server$ sudo docker run --rm -it generic-manylinux2014_x86_64-pyarmor:2024-04-25
[root@f5b858cf77e7 tmp]# /opt/python/cp39-cp39/bin/python -m venv venv
[root@f5b858cf77e7 tmp]# source venv/bin/python
bash: source: venv/bin/python: cannot execute binary file
[root@f5b858cf77e7 tmp]# source venv/bin/activate
(venv) [root@f5b858cf77e7 tmp]# pip install pyarmor
Collecting pyarmor
Using cached pyarmor-8.5.7-py3-none-any.whl (2.7 MB)
Collecting pyarmor.cli.core~=6.5.1
Using cached pyarmor.cli.core-6.5.1-cp39-none-manylinux1_x86_64.whl (459 kB)
Installing collected packages: pyarmor.cli.core, pyarmor
Successfully installed pyarmor-8.5.7 pyarmor.cli.core-6.5.1
[notice] A new release of pip is available: 23.0.1 -> 24.0
[notice] To update, run: pip install --upgrade pip
(venv) [root@f5b858cf77e7 tmp]# touch test.py
(venv) [root@f5b858cf77e7 tmp]# pyarmor -d gen test.py
INFO Python 3.9.19
INFO Pyarmor 8.5.7 (pro), 00xxxx, clarity-studio
INFO Platform linux.x86_64
DEBUG native platform linux.x86_64
DEBUG home path: /root/.pyarmor
DEBUG command options: {'no_runtime': False, 'inputs': ['test.py']}
DEBUG install plugin: CodesignPlugin
DEBUG install plugin: DarwinUniversalPlugin
INFO search inputs ...
INFO find script test.py
INFO find 1 top resources
DEBUG unknown error, please check pyarmor.error.log
ERROR invalid license token, try to run `pyarmor reg` to register license again
ERROR somthing is wrong
*=============================================================*
* Please check *
* https://pyarmor.readthedocs.io/en/latest/questions.html *
* or run `pyarmor man` to find solutions quickly *
* *
* It's recommand to report issue by `pyarmor man` in order *
* to provide necessary information, and avoid dupcliated *
* issues or unclear question. *
*=============================================================*
(venv) [root@f5b858cf77e7 tmp]# pyarmor -d gen test.py
INFO Python 3.9.19
INFO Pyarmor 8.5.7 (trial), 000000, non-profits
INFO Platform linux.x86_64
DEBUG native platform linux.x86_64
DEBUG home path: /root/.pyarmor
DEBUG command options: {'no_runtime': False, 'inputs': ['test.py']}
DEBUG install plugin: CodesignPlugin
DEBUG install plugin: DarwinUniversalPlugin
INFO search inputs ...
INFO find script test.py
INFO find 1 top resources
^[[AINFO start to generate runtime files
INFO target platforms {'linux.x86_64'}
DEBUG got /tmp/venv/lib/python3.9/site-packages/pyarmor/cli/core/pyarmor_runtime.so
INFO write dist/pyarmor_runtime_00xxxx/pyarmor_runtime.so
DEBUG patching runtime data at 780576
DEBUG patch runtime file OK
DEBUG call post runtime plugin <class 'pyarmor.cli.plugin.CodesignPlugin'>
INFO generate runtime files OK
INFO start to obfuscate scripts
INFO process resource "test"
INFO obfuscating file test.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
INFO write dist/test.py
INFO obfuscate scripts OK
DEBUG call post build plugin <class 'pyarmor.cli.plugin.DarwinUniversalPlugin'>
(venv) [root@f5b858cf77e7 tmp]# pyarmor -d gen test.py
INFO Python 3.9.19
INFO Pyarmor 8.5.7 (pro), 00xxxx, clarity-studio
INFO Platform linux.x86_64
DEBUG native platform linux.x86_64
DEBUG home path: /root/.pyarmor
DEBUG command options: {'no_runtime': False, 'inputs': ['test.py']}
DEBUG install plugin: CodesignPlugin
DEBUG install plugin: DarwinUniversalPlugin
INFO search inputs ...
INFO find script test.py
INFO find 1 top resources
INFO start to generate runtime files
INFO target platforms {'linux.x86_64'}
DEBUG got /tmp/venv/lib/python3.9/site-packages/pyarmor/cli/core/pyarmor_runtime.so
INFO write dist/pyarmor_runtime_00xxxx/pyarmor_runtime.so
DEBUG patching runtime data at 780576
DEBUG patch runtime file OK
DEBUG call post runtime plugin <class 'pyarmor.cli.plugin.CodesignPlugin'>
INFO generate runtime files OK
INFO start to obfuscate scripts
INFO process resource "test"
INFO obfuscating file test.py
DEBUG process inline marker
DEBUG parse script
DEBUG process co
DEBUG patch co
INFO write dist/test.py
INFO obfuscate scripts OK
DEBUG call post build plugin <class 'pyarmor.cli.plugin.DarwinUniversalPlugin'>
Try to install this pre-release core, for example
pip install https://pyarmor.dashingsoft.com/downloads/temp/pyarmor.cli.core-6.5.2-cp39-none-manylinux1_x86_64.whl && pip install pyarmor
The pre-release core fixes one update token issue.
Note that once pyarmor.cli.core
v6.5.2 is released, this temporary link won't work. And after it's released, only pip install pyarmor
is enough.
Fixed in v8.5.9