From ca02d79acadfc4af1a3f0efa94533b7bc5f1cdfc Mon Sep 17 00:00:00 2001 From: Steve Schwarz Date: Mon, 16 Oct 2017 15:18:13 -0500 Subject: [PATCH] Run pilbox.image in py2 or py3 --- pilbox/image.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pilbox/image.py b/pilbox/image.py index f4ae69c..c23ff54 100644 --- a/pilbox/image.py +++ b/pilbox/image.py @@ -518,7 +518,10 @@ def main(): quality=options.quality, progressive=options.progressive, preserve_exif=options.preserve_exif) - sys.stdout.write(stream.read()) + try: + sys.stdout.buffer.write(stream.read()) + except AttributeError: + sys.stdout.write(stream.read()) stream.close()