[issue6832] Outputting unicode crushes when printing to file on Linux

Jerzy report at bugs.python.org
Thu Sep 3 11:29:55 CEST 2009


New submission from Jerzy <jerzyo at genesilico.pl>:

Hi

When I am outputting unicode strings to terminal my script works OK, but
when I redirect it to file I get a crash:

$ python mailing/message_sender.py -l Bia
Białystok

$ python mailing/message_sender.py -l Bia > ~/tmp/aaa.txt 
Traceback (most recent call last):
  File "mailing/message_sender.py", line 71, in <module>
    list_groups(unicode(args[0],'utf-8'))
  File "mailing/message_sender.py", line 53, in list_groups
    print group[1].name
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0142' in
position 3: ordinal not in range(128)

----------
components: Unicode
messages: 92196
nosy: Orlowski
severity: normal
status: open
title: Outputting unicode crushes when printing to file on Linux
type: crash
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6832>
_______________________________________


More information about the Python-bugs-list mailing list