[PyPy-issue] [issue712] Cannot change encoding used by print statement?

Gerlof Bouma pypy-dev-issue at codespeak.net
Tue May 3 11:35:06 CEST 2011

New submission from Gerlof Bouma <gerlof.bouma at gmail.com>:

Using the print *statement* to write to a file with an encoding other than ascii
doesn't seem to work, raising a EncodingError even if writing is handled through
the codecs module and is supposed to be able to handle, say, utf8. The issue
does not show up when using __future__.print_function or f.write(...). 

Attached is a file demonstrating the contrast between ".write(bla)" and "print
bla". In the example I used sys.stdout but the problem is the same with printing
to a (proper) file. 

The problem shows up in pypy 1.4 and 1.5. CPython doesn't have the issue.

effort: ???
files: uc_print_demo.py
messages: 2486
nosy: gjb, pypy-issue
priority: bug
release: ???
status: unread
title: Cannot change encoding used by print statement?

PyPy development tracker <pypy-dev-issue at codespeak.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uc_print_demo.py
Type: text/x-python
Size: 532 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pypy-issue/attachments/20110503/6a60c54c/attachment.py>

More information about the Pypy-issue mailing list