使用 pyminifier 库对 python 代码进行加密混淆报错:
Traceback (most recent call last):File "d:\work\python3.9_64\lib\runpy.py", line 197, in _run_module_as_mainreturn _run_code(code, main_globals, None,File "d:\work\python3.9_64\lib\runpy.py", line 87, in _run_codeexec(code, run_globals)File "D:\work\python3.9_64\Scripts\pyminifier.exe\__main__.py", line 7, in <module>File "d:\work\python3.9_64\lib\site-packages\pyminifier\pyminifier.py", line 394, in mainsource = open(args[0]).read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 54: illegal multibyte sequence
根据报错的位置找到代码:
"d:\work\python3.9_64\lib\site-packages\pyminifier\pyminifier.py"
指定编码 encoding="utf-8"
。
再次执行成功。
喜欢的点个赞?吧!