[reportlab-users] Writing to stdout

Christoph Zwerschke cito at online.de
Sun Feb 28 13:40:39 EST 2021


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


More information about the reportlab-users mailing list