2009/12/7 sleepjunk <sleepj...@gmail.com>: > Thanks so much for your help. I'm sorry to ask another question, but I > am getting an error and have spent a few hours trying to figure it > out. Googling has not helped me. > > Environment: > > Request Method: GET > Request URL: http://127.0.0.1:8000/ > Django Version: 1.1.1 > Python Version: 2.6.4 > Installed Applications: > ['django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.sites', > 'django.contrib.admin', > 'discvideos.videos'] > Installed Middleware: > ('django.middleware.common.CommonMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware') > > > Traceback: > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ > site-packages/django/core/handlers/base.py" in get_response > 92. response = callback(request, *callback_args, > **callback_kwargs) > File "/Users/matt/Sites/discvideos/../discvideos/videos/views.py" in > home_page > 21. tree = ET.parse(feed) > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ > xml/etree/ElementTree.py" in parse > 862. tree.parse(source, parser) > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ > xml/etree/ElementTree.py" in parse > 586. parser.feed(data) > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ > xml/etree/ElementTree.py" in feed > 1245. self._parser.Parse(data, 0) > File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ > xml/etree/ElementTree.py" in _default > 1201. self._parser.ErrorColumnNumber) > > Exception Type: ExpatError at / > Exception Value: undefined entity …: line 198, column 55
Try adding this before line 5 in your the code you linked to: parser = ET.XMLParser() parser.entity['hellip'] = "" Then change, tree = ET.parse(feed) to, tree = ET.parse(feed, parser) This will ignore all instances of the … entity that exists only in HTML, and not XML. You can replace it with another character if you want; just replace "" with something else. Docs for XMLParser here - http://effbot.org/elementtree/elementtree-xmlparser.htm Also saw that your context doesn't include videos_context. It needs to, otherwise all the work you just did would be inaccessible in the template. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.