Reputation: 47
crawl.py. I try to port it to python3. I leave out all unnecessary details. Error:
Traceback (most recent call last):
File "crawl.py", line 44, in parseAndGetLinks
self.parser = html.parser(AbstractFormatter(DumbWriter(StringIO())))
TypeError: 'module' object is not callable
import html.parser
from formatter import DumbWriter, AbstractFormatter
from io import StringIO
parser = html.parser(AbstractFormatter(DumbWriter(StringIO())))
Upvotes: 0
Views: 1917
Reputation: 1122282
html.parser
is the module; you want the HTMLParser
class in that module:
parser = html.parser.HTMLParser(AbstractFormatter(DumbWriter(StringIO())))
or more succinctly:
from html.parser import HTMLParser
parser = HTMLParser(AbstractFormatter(DumbWriter(StringIO())))
Upvotes: 5