Looks like a bug that was fixed about three years ago. What version of 
web2py are you using?

Anthony

On Sunday, March 6, 2016 at 6:22:49 AM UTC-5, Robin Manoli wrote:
>
> Hello, I have this code to read html files. The code was working on a 
> different system with an old installation of web2py (not sure if gluon.html 
> could have changed).
>
> import gluon.html
>
> def myfunc(path, filename):
>     with open(path+filename, 'r') as content_file:
>         html = content_file.read()
>     try:
>         parsed_html = gluon.html.TAG(html)
>     except ValueError:
>         print ('Unknown error')
>         return
> myfunc(path, filename)
>
>
>
> Now I get this error:
>
>   File "x.py", line 50, in myfunc
>     parsed_html = gluon.html.TAG(html)
>   File "/usr/lib/pymodules/python2.7/gluon/html.py", line 1092, in __call__
>     return web2pyHTMLParser(decoder.decoder(html)).tree
>   File "/usr/lib/pymodules/python2.7/gluon/html.py", line 2233, in __init__
>     self.feed(text)
>   File "/usr/lib/python2.7/HTMLParser.py", line 117, in feed
>     self.goahead(0)
>   File "/usr/lib/python2.7/HTMLParser.py", line 191, in goahead
>     self.handle_charref(name)
>   File "/usr/lib/pymodules/python2.7/gluon/html.py", line 2258, in 
> handle_charref
>     self.parent.append(unichr(int(name[1:], 10)).encode('utf8'))
> ValueError: invalid literal for int() with base 10: '32D'
>
> Not sure if the html might be malformed
>
> Any idea what is wrong?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to