[PyQt] unicode and pyqt4

Janwillem van Dijk jwevandijk at xs4all.nl
Wed Nov 24 16:40:43 GMT 2010


On 11/24/2010 10:04 AM, Yao Ko wrote:
> On Wed, Nov 24, 2010 at 12:58 AM, Janwillem van Dijk
> <jwevandijk at xs4all.nl>  wrote:
>    
>> I have a small application that displays a tree structure using ete2
>> (http://ete.cgenomics.org/). The node names are unicode and contain in
>> particular German and French special chars. When I run the script from Eric4
>> or directly from a terminal with  "python scriptname.py" all is OK. However
>> I want to run it as a subprocess and than the special chars generate errors:
>>
>> import subprocess
>> arg =['python', script_path_name]
>> p = subprocess.Popen(arg)
>>      
> What's the error output?
>
> Yao
>
>
>    
The traceback.print_exc gives:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in 
position 1: ordinal not in range(128)
print u'\xe4' correctly shows the German a-umlaut

I made a small PyQt4 test prog with a painTextEdit that shows the 
character correctly, both when started directly and as a subprocess. 
Sometimes I think I understood the in and outs of unicode and sometimes 
I think I am getting mad of unicode and (Qt) python.

Any suggestions where to look?
Thanks, Janwillem



More information about the PyQt mailing list