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:
parent
b9a4621b2d
commit
3caeb4504e
|
@ -298,7 +298,10 @@ def save_image(data, path):
|
|||
:param path: path to save the image to
|
||||
"""
|
||||
if path is None:
|
||||
image = sys.stdout
|
||||
if six.PY3:
|
||||
image = sys.stdout.buffer
|
||||
else:
|
||||
image = sys.stdout
|
||||
else:
|
||||
image = open(path, 'wb')
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue