I met this error when it was unpacking the boot.img, only if I set LC_ALL=C
before execute this command or comment the code setup_locale()
it works. Is there any better solutions? I think the locale change in somewhere when executing the script. My default locale is zh_CN.UTF-8, running on Archlinux, Python 3.10
$ python -m aospdtgen /home/wbs/android/dumpyara/working/out
Android device tree generator
Version 0.1.0
[2022-06-12 12:17:11,938] [manifest.py:76 WARNING] import_file: Unknown HAL type native
[2022-06-12 12:17:12,398] [__init__.py:104 INFO] __init__: Cloning AIK...
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/wbs/.local/lib/python3.10/site-packages/aospdtgen/__main__.py", line 11, in <module>
main()
File "/home/wbs/.local/lib/python3.10/site-packages/aospdtgen/main.py", line 30, in main
dump = DeviceTree(args.dump_path)
File "/home/wbs/.local/lib/python3.10/site-packages/aospdtgen/devicetree.py", line 75, in __init__
self.boot_configuration = BootConfiguration(self.path / "boot.img",
File "/home/wbs/.local/lib/python3.10/site-packages/aospdtgen/utils/boot_configuration.py", line 28, in __init__
self.boot_image_info = self.boot_aik_manager.unpackimg(self.boot)
File "/home/wbs/.local/lib/python3.10/site-packages/sebaubuntu_libs/libaik/__init__.py", line 112, in unpackimg
process = self._execute_script("unpackimg.sh", image)
File "/home/wbs/.local/lib/python3.10/site-packages/sebaubuntu_libs/libaik/__init__.py", line 193, in _execute_script
return check_output(command, stderr=STDOUT, universal_newlines=True)
File "/usr/lib/python3.10/subprocess.py", line 420, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.10/subprocess.py", line 503, in run
stdout, stderr = process.communicate(input, timeout=timeout)
File "/usr/lib/python3.10/subprocess.py", line 1139, in communicate
stdout = self.stdout.read()
File "/usr/lib/python3.10/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 562: ordinal not in range(128)