Unicode again ... default codec ...

Lele Gaifax lele at metapensiero.it
Thu Oct 22 07:59:00 EDT 2009


"Gabriel Genellina" <gagsl-py2 at yahoo.com.ar> writes:

> En Thu, 22 Oct 2009 05:25:16 -0300, Lele Gaifax <lele at metapensiero.it>
> escribió:
>> Who is the culprit here?
>
> unittest, or ultimately, this bug: http://bugs.python.org/issue4947

Thank you. In particular I found
http://bugs.python.org/issue4947#msg87637 as the best fit, I think
that may be what's happening here.

> fix: add this method to the _WritelnDecorator class in unittest.py
> (near line 664):
>
>     def write(self, arg):
>         if isinstance(arg, unicode):
>             arg = arg.encode(self.stream.encoding, "replace")
>         self.stream.write(arg)

Uhm, that's almost as dirty as my reload(), you must admit! :-)

bye, lele.
-- 
nickname: Lele Gaifax    | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas    | comincerò ad aver paura di chi mi copia.
lele at nautilus.homeip.net |                 -- Fortunato Depero, 1929.




More information about the Python-list mailing list