Re: Writing to stdout

Christoph Zwerschke <[email protected]> Sun, 28 Feb 2021 19:40:39 +0100
Newsgroups gmane.comp.python.reportlab.user
Message-ID <[email protected]>
On 28.02.2021 18:55, Rob Allen wrote:
 > This is what happens when I run it:
 >
 > ...
 > TypeError: write() argument must be str, not bytes


This is probably because stdout is expecting text (native strings), but 
ReportLab sends bytes.

It may work when replacing sys.stdout with something like 
TextIOWrapper(sys.stdout.buffer, encoding='utf8').

-- Christoph