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

Fix issue where attempting to download a binary file fails #163

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

penn5
Copy link

@penn5 penn5 commented Jun 21, 2019

It occured because the file is opened in 'r' mode and .encode("utf-8")'d rather than just opening in 'rb' mode to start with. Sometimes a 'r' file may be provided, so we have to maintain compatibility with this case.

It occured because the file is opened in 'r' mode and .encode("utf-8")'d rather than just opening in 'rb' mode to start with. Sometimes a 'r' file may be provided, so we have to maintain compatibility with this case.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 43.623% when pulling 6a627fc on penn5:patch-2 into 0e50795 on google:master.

@penn5
Copy link
Author

penn5 commented Jul 22, 2019

Any updates? I just had to guide a user through installing this branch because they encountered this issue.

@fvguilherme
Copy link

Any updates? I just had to guide a user through installing this branch because they encountered this issue.

I can confirm this. I got this:

File "/usr/lib/python3.7/site-packages/adb/fastboot.py", line 291, in FlashFromFile
  progress_callback=progress_callback)
File "/usr/lib/python3.7/site-packages/adb/fastboot.py", line 326, in Download
  source_file, source_len, info_cb, progress_callback=progress_callback)
File "/usr/lib/python3.7/site-packages/adb/fastboot.py", line 137, in HandleDataSending
  self._Write(source_file, accepted_size, progress_callback)
File "/usr/lib/python3.7/site-packages/adb/fastboot.py", line 195, in _Write
  tmp = data.read(self.chunk_kb * 1024)
File "/usr/lib/python3.7/codecs.py", line 322, in decode
  (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbd in position 2: invalid start byte

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 this pull request may close these issues.

3 participants