[Eric] Unicode error if run ouside Eric

Detlev Offenbach detlev at die-offenbachs.de
Sun Feb 13 15:55:32 GMT 2011


On Sonntag, 13. Februar 2011, starglider develop wrote:
> Hi,
> I made a applications in Python 2.6 and PyQt, everything works fine,
> until I try too run it in OS X and Windows XP, it gives the error:
> UnicodeEncodeError: 'ascii' codec can't encode characters in position 3-4:
> ordinal not in range(128)
> I though it was from the other O.S., but I realize that when run in the
> development machine
> from the command line it gives the same error, like the other O.S.
> Conclusion:
> if run from Eric4 works fine if runs from the bash gives the UnicodeError.
> Any way to solve this issue?
> 
> Thank you in advance for your help.
> 
> P.S.-Using python 2.6 in Fedora 13, and portuguese characters.

eric4 set the system default encoding to the value selected in the 
configuration dialog (default is utf-8). This is done by saving a function of 
the sys module via eric4.pth. This function is deleted by Python otherwise.

You can do something similiar in your code or give an encoding to all calls to 
unicode(...).

Regards,
Detlev
-- 
Detlev Offenbach
detlev at die-offenbachs.de


More information about the Eric mailing list