Re: Newbie, list has no attribute iteritems

2008-07-04 Thread Bruno Desthuilliers
rabad a écrit : Hi, I've created a custom filter based on HTMLParser, with the following source: (snip) But when I use it, it gives me the following error message: ERROR Processor exception: AttributeError: 'list' object has no attribute 'iteritems' (snip) File "d:\esp\lib\python2.3\pr

Re: Newbie, list has no attribute iteritems

2008-07-04 Thread Justin Ezequiel
def handle_starttag(self, tag, attrs): # <-- attrs here is a list if 'a' != tag: self.stack.append(self.__html_start_tag(tag, attrs))# <-- attrs here is still a list return attrs = dict(attrs)# <-- now attrs is a dictionary -- http://mail.python

Newbie, list has no attribute iteritems

2008-07-04 Thread rabad
Hi, I've created a custom filter based on HTMLParser, with the following source: class Filter(HTMLParser): def __init__(self, keyfile): HTMLParser.__init__(self) mykwfile = open(keyfile, 'r') self._keywords = [] for kw in mykwfile.read().split('\n'):