Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

UnicodeDecodeError on fastboot.Download(filename) #145

Open
FT-Liang opened this issue Jan 10, 2019 · 1 comment · May be fixed by #179
Open

UnicodeDecodeError on fastboot.Download(filename) #145

FT-Liang opened this issue Jan 10, 2019 · 1 comment · May be fixed by #179

Comments

@FT-Liang
Copy link

Hi,
I've encountered the following exception on running fastboot.Download(filename) with python 3.6:

Traceback (most recent call last):
  File "python-adb/adb/fastboot.py", line 326, in Download
    source_file, source_len, info_cb, progress_callback=progress_callback)
  File "python-adb/adb/fastboot.py", line 137, in HandleDataSending
    self._Write(source_file, accepted_size, progress_callback)
  File "python-adb/adb/fastboot.py", line 195, in _Write
    tmp = data.read(self.chunk_kb * 1024)
  File "/usr/lib/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9b in position 7: invalid start byte

Changing source_file = open(source_file) to source_file = open(source_file, mode='rb') fix the problem, not sure if this is really a bug or by-design though.

@Jamirsen
Copy link

I am also running into the same issue on Python 3.6.5 Using that change source_file = open(source_file, mode='rb') fixed my issue as well

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

Successfully merging a pull request may close this issue.

2 participants