unicode and os.system

Erik Max Francis max at alcyone.com
Fri Sep 2 19:46:34 EDT 2005


Dumbkiwi wrote:

> I've tried that previously, and get:
> 
> Traceback (most recent call last):
>   File "/home/matt/karamba/lwbkup/liquid_weather.py", line 2765, in initWidget
>     os.system('dcop kxdocker docker addIcon Current %s "%s : %s" /dev/null GIcon lwp none none none none' %(icopath, QString(situtext.decode('utf-8'), weather.temperature()))
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in
> position 9: ordinal not in range(128)
> 
> Thanks for responding though.

That means one of the other things you're trying to print with %s is 
also a Unicode string, and it contains non-ASCII characters.  Try 
printing their types to see which one it is.

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   Liberty is the right to do whatever the law permits.
   -- Charles Louis Montesquieu



More information about the Python-list mailing list