From 4d005c8443843cd15ccec7f3a6c3f7df4fff45f7 Mon Sep 17 00:00:00 2001 From: josch Date: Mon, 16 Feb 2015 19:20:06 +0100 Subject: [PATCH] write to sys.stdout.buffer and fall back to sys.stdout --- src/img2pdf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/img2pdf.py b/src/img2pdf.py index ab689b6..21067b1 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -347,7 +347,7 @@ parser.add_argument( nargs='+', help='input file(s)') parser.add_argument( '-o', '--output', metavar='out', type=argparse.FileType('wb'), - default=sys.stdout, help='output file (default: stdout)') + default=getattr(sys.stdout, "buffer", sys.stdout), help='output file (default: stdout)') parser.add_argument( '-d', '--dpi', metavar='dpi', type=positive_float, help='dpi for pdf output (default: 96.0)')