Re: UnicodeEncodeError during repr()

2010-04-19 Thread Dave Angel
gb345 wrote: In "Martin v. Loewis" writes: Do I need to do something especial to get repr to work strictly with unicode? Yes, you need to switch to Python 3 :-) Or should __repr__ *always* return bytes rather than unicode? In Python 2.x: yes.

Re: UnicodeEncodeError during repr()

2010-04-19 Thread gb345
In "Martin v. Loewis" writes: >> Do I need to do something especial to get repr to work strictly >> with unicode? >Yes, you need to switch to Python 3 :-) >> Or should __repr__ *always* return bytes rather than unicode? >In Python 2.x: yes. >> What about __str__ ? >Likewise. >> If both of

Re: UnicodeEncodeError during repr()

2010-04-19 Thread Martin v. Loewis
> Do I need to do something especial to get repr to work strictly > with unicode? Yes, you need to switch to Python 3 :-) > Or should __repr__ *always* return bytes rather than unicode? In Python 2.x: yes. > What about __str__ ? Likewise. > If both of these are supposed to return bytes, > the

UnicodeEncodeError during repr()

2010-04-18 Thread gb345
I'm getting a UnicodeEncodeError during a call to repr: Traceback (most recent call last): File "bug.py", line 142, in element = parser.parse(INPUT) File "bug.py", line 136, in parse ps = Parser.Parse(open(filename,'r').read(), 1) File "bug.py", line 97, in end_item r = rep