UnicodeEncodeError when not running script from IDE

Terry Reedy tjreedy at udel.edu
Tue Feb 12 11:07:51 EST 2013


On 2/12/2013 7:34 AM, Magnus Pettersson wrote:
> Ahh so its the actual printing that makes it error out outside of
> eclipse because its a different terminal that its printing to. Its
> the default DOS terminal in windows that runs then i run the script
> with python.exe and i guess its the same when i run with pythonw.exe
> just that the terminal window is not opened up, only the pyqt gui in
> this case.

Writing

txt = <expression involving coding>
print(txt)

rather than

print(<expression involving coding>)

makes it easier to tell whether a UnicodeError comes from evaluating the 
expression or from the print operation.

Using 3.3 instead of 2.7 will make using unicode somewhat easier.

-- 
Terry Jan Reedy




More information about the Python-list mailing list