Hello! New to salix forum and first post
I get a 'UnicodeDecodeError' while filtering spi output.
Example:
spi python | grep -i kde
lists pykde4 (the package i was looking for) and after that
Traceback (most recent call last):
File "/usr/bin/spi", line 436, in <module>
main(sys.argv[1:])
File "/usr/bin/spi", line 94, in main
search(args)
File "/usr/bin/spi", line 205, in search
print pkgname+' ['+pkginst+']:', pkgdesc
File "/usr/lib64/python2.7/codecs.py", line 351, in write
data , consumed = self.encode(object, self.errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 52: ordinal not in range(128)
Searching 'spi x | grep <anything>' shows same error, just changes byte and position in last line.
Filtering find, locate or cat (for example) with grep don't show error, as well as spi <anything>, and spi works ok apart from the error, as I could install pykde4 after that.
System is Salix 14.1 Kde beta1 64 bits, fresh install on empty / and /home partitions. Only Abiword and Gnumeric installed before that.
Any idea? Could it be my fault?
UnicodeDecodeError with spi and grep
Re: UnicodeDecodeError with spi and grep
Not your fault. This is actually a bug/problem with python. When outputting directly to the terminal it knows what encoding to use, but when piping the output, it doesn't. A workaround is to set:
and then run the command. You can add that to your ~/.bashrc if you like.
I'll try to find if there is another workaround that I can use directly in spi...
Code: Select all
export PYTHONIOENCODING=utf-8
I'll try to find if there is another workaround that I can use directly in spi...
Re: UnicodeDecodeError with spi and grep
I have uploaded spi 0.4 to the repos. It fixes this problem without having to export that variable anymore.