🐛 Fix Python 2 compatibility

This commit is contained in:
Franck Nijhof 2017-08-28 19:46:51 +02:00
parent 2fda17f49d
commit 82b9681ea2
No known key found for this signature in database
GPG key ID: D62583BA8AB11CA3

View file

@ -65,7 +65,10 @@ class Streamer(object):
def stream_context(self):
"""Start streaming the tar context for Docker."""
with TarFile.open(mode='w|', fileobj=sys.stdout.buffer) as tarfile:
with TarFile.open(
mode='w|',
fileobj=getattr(sys.stdout, 'buffer', sys.stdout)
) as tarfile:
tarfile.add(
self.context,