Question regarding HTMLParser module.
adonisv at earthlink.net
Mon Jul 28 06:05:27 CEST 2003
When parsing my html files, I use handle_pi to capture some embedded python
code, but I have noticed that in the embedded python code if it contains
html, HTMLParser will parse it as well, and thus causes an error when I exec
the code, raises an EOL error. I have a work around for this as I use
different set of characters rather that <tag> use something like (tag) then
revert it back to <tag> via another function, I was wondering if there is a
way to tell HTMLParser to ignore the embedded tags or another alternative?
Any help would be greatly appreciated.
And another note, I am well aware of Zope, Webware, CherryPy, etc... for
py/html embedding options, but I want this to be a learning experience.
HTML processing instruction:
Traceback (most recent call last):
File "C:\home\Adonis\python\t.py", line 40, in -toplevel-
File "C:\Python23\lib\HTMLParser.py", line 108, in feed
File "C:\Python23\lib\HTMLParser.py", line 154, in goahead
k = self.parse_pi(i)
File "C:\Python23\lib\HTMLParser.py", line 232, in parse_pi
File "C:\home\Adonis\python\t.py", line 33, in handle_pi
File "<string>", line 4
SyntaxError: EOL while scanning single-quoted string
More information about the Python-list