Unable to run print('Réussi') on windows and on linux

Peter Otten __peter__ at web.de
Thu Aug 14 12:00:56 EDT 2014


marc.vanhoomissen at gmail.com wrote:

> Le jeudi 14 août 2014 15:22:52 UTC+2, Vincent Vande Vyvre a écrit :

>> Are you really using Python 3 ?

>> $ python3 test.py
> 
> Actually, when I try using a terminal, it works:
> $ python3 test.py
> Réussi
> 
> But when I issue the same command using webmin (v. 1.700 - shell command),
> I got:
>> python3 test.py
> Traceback (most recent call last):
>   File "test.py", line 2, in <module>
>     print('R\xe9ussi')
> UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in
> position 1: ordinal not in range(128)
> 
> So, I guess it is merely a problem of webmin.

I have no idea how that might interact with webmin, but you could try to set 
the environment variable

PYTHONIOENCODING=utf-8





More information about the Python-list mailing list