Program works great, except under less, cron or execl (Unicode?)

Sam samslists at gmail.com
Thu Sep 18 10:57:26 CEST 2008


I have a program which works great when run from the command line.

But when I run it combined with something else such as:
- piping it through less
- cron
- execl (i.e. calling it from another python program)

it gives me a unicode error

 File "../myparser.py", line 261, in set_attributes
    print "self.atd['Name'] is: ", self.atd['Name']
UnicodeEncodeError: 'ascii' codec can't encode character u'\xeb' in
position 7: ordinal not in range(128)

I'd post the whole program here, except it involves weird Unicode
strings.

I could probably change the program to get it working under less/cron/
etc.

But I'd rather understand exactly what the issue is.  Why does it work
fine when run directly from the command line, but not otherwise?



More information about the Python-list mailing list