dashingsoft / pyarmor

A tool used to obfuscate python scripts, bind obfuscated scripts to fixed machine or expire obfuscated scripts.

Home Page:http://pyarmor.dashingsoft.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] `--pack` doesnt work with `--enable-rft` or `--assert-call/import`

jondy opened this issue · comments

$ pyarmor gen --pack onefile --enable-rft myapp.py
INFO     Python 3.7.10
INFO     Pyarmor 8.5.8 (pro), 005068, btarmor
INFO     Platform darwin.x86_64
INFO     implicitly save obfuscated scripts to ".pyarmor/pack/dist"
...
ERROR    'NoneType' object has no attribute 'find'
ERROR    somthing is wrong
...

The content of pyarmor.error.log

38676 MainProcess 2024-04-29 09:30:17,369
Traceback (most recent call last):
  File "/Users/jondy/workspace/pyarmor-webui/venv/lib/python3.7/site-packages/pyarmor/cli/__main__.py", line 764, in main
    main_entry(sys.argv[1:])
  File "/Users/jondy/workspace/pyarmor-webui/venv/lib/python3.7/site-packages/pyarmor/cli/__main__.py", line 752, in main_entry
    return args.func(ctx, args)
  File "/Users/jondy/workspace/pyarmor-webui/venv/lib/python3.7/site-packages/pyarmor/cli/__main__.py", line 240, in cmd_gen
    builder.process(options, packer=packer)
  File "/Users/jondy/workspace/pyarmor-webui/venv/lib/python3.7/site-packages/pyarmor/cli/generate.py", line 173, in process
    self._obfuscate_scripts()
  File "/Users/jondy/workspace/pyarmor-webui/venv/lib/python3.7/site-packages/pyarmor/cli/generate.py", line 129, in _obfuscate_scripts
    code = Pytransform3.generate_obfuscated_script(self.ctx, r)
  File "/Users/jondy/workspace/pyarmor-webui/venv/lib/python3.7/site-packages/pyarmor/cli/core/__init__.py", line 106, in generate_obfuscated_script
    return m.generate_obfuscated_script(ctx, res)
  File "<maker>", line 713, in generate_obfuscated_script
  File "/Users/jondy/workspace/pyarmor-webui/venv/lib/python3.7/site-packages/pyarmor/cli/__init__.py", line 16, in process
    return meth(self, res, *args, **kwargs)
  File "<maker>", line 534, in process
  File "<maker>", line 534, in <listcomp>
  File "<rftmaker>", line 14, in pyarmor_core_755
  File "<rftmaker>", line 624, in process
  File "<rftmaker>", line 591, in _refactor
  File "<rftmaker>", line 585, in pyarmor_core_357
  File "<rftmaker>", line 585, in pyarmor_core_357
  File "<rftmaker>", line 585, in pyarmor_core_357
  File "<rftmaker>", line 566, in pyarmor_core_357
  File "<rftmaker>", line 489, in pyarmor_core_803
AttributeError: 'NoneType' object has no attribute 'find'

It will be fixed in next release

As a quick workaround, just list other moduels and packages in command line. For example

pyamror gen --pack onefile --enable-rft myapp.py util.py mypkg/ mypkg2/

Fixed in 8.5.8