操作系统:Windows 10 python 版本:3.8.5 pyarmor 版本:6.4.2
树:
│ .gitignore
│ main.py
│ README.md
│ requirements.txt
│
├───cogs
│ │ somefile.py
│ │ somefile.py
│ │ somefile.py
│ │ somefile.py
│ │ somefile.py
│ │ somefile.py
│ │ somefile.py
│ │ somefile.py
│ │ somefile.py
│ │ somefile.py
│ │
│ └───__pycache__
│ pyc files
│
└───__pycache__
main.cpython-38.pyc
我想混淆我文件夹中的每个 python 文件。我已在 VS 代码中将编码设置为 utf-8,并且已添加# -*- coding: utf-8 -*-到每个 python 文件的开头。我pyarmor -d obfuscate --recursive main.py从 main.py 运行,它给了我这个回溯:
Traceback (most recent call last):
File "c:\users\User\appdata\local\programs\python\python38-32\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\User\appdata\local\programs\python\python38-32\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\Scripts\pyarmor.exe\__main__.py", line 7, in <module>
File "c:\users\User\appdata\local\programs\python\python38-32\lib\site-packages\pyarmor\pyarmor.py", line 1447, in main_entry
main(sys.argv[1:])
File "c:\users\User\appdata\local\programs\python\python38-32\lib\site-packages\pyarmor\pyarmor.py", line 1439, in main
args.func(args)
File "c:\users\User\appdata\local\programs\python\python38-32\lib\site-packages\pyarmor\pyarmor.py", line 694, in _obfuscate
encrypt_script(prokey, a, b, wrap_mode=args.wrap_mode,
File "c:\users\User\appdata\local\programs\python\python38-32\lib\site-packages\pyarmor\utils.py", line 933, in encrypt_script
f.write(''.join(lines))
File "c:\users\User\appdata\local\programs\python\python38-32\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 177-178: character maps to <undefined>
在 pyarmor 文档中,他们给出了这个可能的修复方法。我已经这样做了,错误仍然存在。