From ab4139e30ca56425fb4f62ebf2d5cb48a0455952 Mon Sep 17 00:00:00 2001 From: Abhishek Kekane Date: Thu, 29 Mar 2018 09:54:19 +0000 Subject: [PATCH] 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 --- glance/common/scripts/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glance/common/scripts/utils.py b/glance/common/scripts/utils.py index f7c95a4af6..533e49426a 100644 --- a/glance/common/scripts/utils.py +++ b/glance/common/scripts/utils.py @@ -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)