Re: Bug in htmlentitydefs.py with Python 3.0?

2007-12-27 Thread Martin v. Löwis
>> I would not write it this way, but as >> >> for name,codepoint in htmlentitydefs.name2codepoint: >> entity_map[name] = unichr(codepoint) > > has dictionary iteration changed in 3.0? if not, your code doesn't > quite work. Right - I forgot to add .items(). > and even if you fix that, it doe

Re: Bug in htmlentitydefs.py with Python 3.0?

2007-12-27 Thread Fredrik Lundh
Martin v. Löwis wrote: >> entity_map = htmlentitydefs.entitydefs.copy() >> for name, entity in entity_map.items(): >> if len(entity) != 1: >> entity_map[name] = unichr(int(entity[2:-1])) >> >> (entitydefs is pretty unusable as it is, but it was added to Python >> before

Re: Bug in htmlentitydefs.py with Python 3.0?

2007-12-27 Thread Martin v. Löwis
> entity_map = htmlentitydefs.entitydefs.copy() > for name, entity in entity_map.items(): > if len(entity) != 1: > entity_map[name] = unichr(int(entity[2:-1])) > > (entitydefs is pretty unusable as it is, but it was added to Python > before Python got Unicode strings, a

Re: Bug in htmlentitydefs.py with Python 3.0?

2007-12-27 Thread Fredrik Lundh
Martin v. Löwis wrote: >> In trying to parse html files using ElementTree running under Python >> 3.0a1, and using htmlentitydefs.py to add "character entities" to the >> parser, I found that I needed to create a customized version of >> htmlentitydefs.py to make things work properly. > > Can you

Re: Bug in htmlentitydefs.py with Python 3.0?

2007-12-26 Thread André
On Dec 26, 8:53 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > Without an additional parser, I was getting the following error > > message: > [...] > > xml.parsers.expat.ExpatError: undefined entity é: line 401, column 11 > > To understand that problem better, it would have been helpful to se

Re: Bug in htmlentitydefs.py with Python 3.0?

2007-12-26 Thread Martin v. Löwis
> Without an additional parser, I was getting the following error > message: [...] > xml.parsers.expat.ExpatError: undefined entity é: line 401, column 11 To understand that problem better, it would have been helpful to see what line 401, column 11 of the input file actually says. AFAICT, it must

Re: Bug in htmlentitydefs.py with Python 3.0?

2007-12-26 Thread André
On Dec 26, 7:30 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > André wrote: > > In trying to parse html files using ElementTree running under Python > > 3.0a1, and using htmlentitydefs.py to add "character entities" to the > > parser, I found that I needed to create a customized version of > >

Re: Bug in htmlentitydefs.py with Python 3.0?

2007-12-26 Thread Martin v. Löwis
André wrote: > In trying to parse html files using ElementTree running under Python > 3.0a1, and using htmlentitydefs.py to add "character entities" to the > parser, I found that I needed to create a customized version of > htmlentitydefs.py to make things work properly. Can you please state what

Bug in htmlentitydefs.py with Python 3.0?

2007-12-26 Thread André
In trying to parse html files using ElementTree running under Python 3.0a1, and using htmlentitydefs.py to add "character entities" to the parser, I found that I needed to create a customized version of htmlentitydefs.py to make things work properly. The change needed was to replace (at the bottom