dashingsoft / pyarmor

A tool used to obfuscate python scripts, bind obfuscated scripts to fixed machine or expire obfuscated scripts.
http://pyarmor.dashingsoft.com
Other
3.46k stars 293 forks source link

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

Closed jondy closed 6 months ago

jondy commented 6 months ago
$ 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'
jondy commented 6 months ago

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/
jondy commented 6 months ago

Fixed in 8.5.8