Fix image-download to stdout on Python 3.x
Glance image-download to stdout fails on Python3 due to sys.stdout.write not allowing bytes to be written directly. A good description of the issue is listed at http://bugs.python.org/issue18512 Closes-Bug: #1528083 Change-Id: I2963914e2e0744410267b5735ff77939413916d4
This commit is contained in:
@@ -298,6 +298,9 @@ def save_image(data, path):
|
|||||||
:param path: path to save the image to
|
:param path: path to save the image to
|
||||||
"""
|
"""
|
||||||
if path is None:
|
if path is None:
|
||||||
|
if six.PY3:
|
||||||
|
image = sys.stdout.buffer
|
||||||
|
else:
|
||||||
image = sys.stdout
|
image = sys.stdout
|
||||||
else:
|
else:
|
||||||
image = open(path, 'wb')
|
image = open(path, 'wb')
|
||||||
|
Reference in New Issue
Block a user