sys.stdout.detach() results in ValueError

Benjamin Peterson benjamin at python.org
Wed Mar 7 22:49:25 EST 2012


Peter Kleiweg <pkleiweg <at> xs4all.nl> writes:
> Not yet using fp in any way, this script gives the following error:
> 
>     Exception ValueError: 'underlying buffer has been detached' in

You're probably using print() or some such which tries to write to sys.stdout.
It's safest to just write to sys.stdout.buffer rather than using detach.







More information about the Python-list mailing list