diff options
| author | Tim Burke <tim.burke@gmail.com> | 2018-06-07 16:40:58 -0700 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2019-04-10 14:34:40 -0500 |
| commit | 415b48056d9d021e04ec972029040a89a6b13928 (patch) | |
| tree | a381db90ad1dc0fff823587ca4121775ae8c0878 /openstackclient/api | |
| parent | c53de3214ed74ffd5b53e6d1cf8a0c0fa73dac99 (diff) | |
| download | python-openstackclient-415b48056d9d021e04ec972029040a89a6b13928.tar.gz | |
Before writing object data to stdout, re-open it in binary mode
Otherwise, you can hit TypeErrors on Python3.
Change-Id: I9a891508886feddac3982ce593bd95130392e035
Closes-Bug: 1775482
Diffstat (limited to 'openstackclient/api')
| -rw-r--r-- | openstackclient/api/object_store_v1.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/openstackclient/api/object_store_v1.py b/openstackclient/api/object_store_v1.py index 31033525..d1e5dfaf 100644 --- a/openstackclient/api/object_store_v1.py +++ b/openstackclient/api/object_store_v1.py @@ -378,8 +378,9 @@ class APIv1(api.BaseAPI): ) if response.status_code == 200: if file == '-': - for chunk in response.iter_content(64 * 1024): - sys.stdout.write(chunk) + with os.fdopen(sys.stdout.fileno(), 'wb') as f: + for chunk in response.iter_content(64 * 1024): + f.write(chunk) else: if not os.path.exists(os.path.dirname(file)): if len(os.path.dirname(file)) > 0: |
