Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我这边有台设备,获取型号是中文,造成报错 #229

Closed
objectBoolean opened this issue Oct 12, 2023 · 0 comments
Closed

我这边有台设备,获取型号是中文,造成报错 #229

objectBoolean opened this issue Oct 12, 2023 · 0 comments

Comments

@objectBoolean
Copy link

[E 231012 17:49:57 apis:89] 'gbk' codec can't decode byte 0xaa in position 2: illegal multibyte sequence
Traceback (most recent call last):
File "E:\pythonProject\adl-solox\venv\Lib\site-packages\solox\view\apis.py", line 63, in deviceids
devices = d.getDevices()
^^^^^^^^^^^^^^
File "E:\pythonProject\adl-solox\venv\Lib\site-packages\solox\public\common.py", line 70, in getDevices
Devices = [f'{id}({self.getDevicesName(id)})' for id in DeviceIds]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\pythonProject\adl-solox\venv\Lib\site-packages\solox\public\common.py", line 70, in
Devices = [f'{id}({self.getDevicesName(id)})' for id in DeviceIds]
^^^^^^^^^^^^^^^^^^^^^^^
File "E:\pythonProject\adl-solox\venv\Lib\site-packages\solox\public\common.py", line 64, in getDevicesName
devices_name = os.popen(f'{self.adb} -s {deviceId} shell getprop ro.product.model').readlines()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'gbk' codec can't decode byte 0xaa in position 2: illegal multibyte sequence

建议改成:devices_name = os.popen(f'{self.adb} -s {deviceId} shell getprop ro.product.model').buffer.readlines()[0].decode("utf-8")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant