Python 3.5: Image Import fails with Unicode Error

Newly added image import api fails for python 3.5 as it
raises Unicode error as it fails to open file in binary mode.

Added 'rb' mode while opening the file which will open the provided
file in binary mode.

Change-Id: I297a415d6fa8700c6a131e0931d11bda65265c73
Closes-Bug: #1759510
(cherry picked from commit ab4139e30c)
This commit is contained in:
Abhishek Kekane 2018-03-29 09:54:19 +00:00
parent 2221868690
commit 0da269128e
1 changed files with 1 additions and 1 deletions

View File

@ -136,6 +136,6 @@ def get_image_data_iter(uri):
#
# We're not using StringIO or other tools to avoid reading everything
# into memory. Some images may be quite heavy.
return open(uri, "r")
return open(uri, "rb")
return urllib.request.urlopen(uri)