diff options
| author | Andy Botting <andy@andybotting.com> | 2015-12-21 12:18:08 +1100 |
|---|---|---|
| committer | Andy Botting <andy@andybotting.com> | 2015-12-22 14:42:15 +1100 |
| commit | 3caeb4504e7f96130f904356bf45f93fcd7834c6 (patch) | |
| tree | c4fe0669978105dc73f7764f783dab103824d9f3 | |
| parent | b9a4621b2dc1eacae8bc5cf406bf5b7464e491e3 (diff) | |
| download | python-glanceclient-3caeb4504e7f96130f904356bf45f93fcd7834c6.tar.gz | |
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
| -rw-r--r-- | glanceclient/common/utils.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/glanceclient/common/utils.py b/glanceclient/common/utils.py index 88144ef..e7c0992 100644 --- a/glanceclient/common/utils.py +++ b/glanceclient/common/utils.py @@ -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: |
