jedie/python-creole — Issue #6: problem with html2creole AttributeError: 'NoneType' object has no attribute 'parent'
Author: sentimentalbryan
Created: 2012-02-20 14:48:57+00:00
State: open

I'm getting an error when running the following code

f = open("/tmp/test.html","r")
html2creole(unicode(fr,errors='ignore'))
In [54]: html2creole(unicode(fr,errors='ignore'))

In [53]: html2creole(unicode(fr,errors='ignore'))
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)

/tmp/ in ()

/usr/local/lib/python2.7/dist-packages/creole/__init__.pyc in html2creole(html_string, debug, parser_kwargs, emitter_kwargs, unknown_emit)
110 warnings.warn("parser_kwargs argument in html2creole would be removed in the future!", PendingDeprecationWarning)
111
--> 112 document_tree = parse_html(html_string, debug=debug)
113
114 emitter_kwargs2 = {

/usr/local/lib/python2.7/dist-packages/creole/__init__.pyc in parse_html(html_string, debug)
91
92 h2c = HtmlParser(debug=debug)
---> 93 document_tree = h2c.feed(html_string)
94 if debug:
95 h2c.debug()

/usr/local/lib/python2.7/dist-packages/creole/html_parser/parser.pyc in feed(self, raw_data)
157 # print("-"*79)

158
--> 159 HTMLParser2.feed(self, data)
160
161 return self.root

/usr/lib/python2.7/HTMLParser.pyc in feed(self, data)
107 """
108 self.rawdata = self.rawdata + data
--> 109 self.goahead(0)
110
111 def close(self):

/usr/lib/python2.7/HTMLParser.pyc in goahead(self, end)
151 k = self.parse_starttag(i)
152 elif startswith(" 153 k = self.parse_endtag(i)
154 elif startswith(" 100 self.handle_endtag(tag.lower())
101 self.clear_cdata_mode()
102 return j
/usr/local/lib/python2.7/dist-packages/creole/html_parser/parser.pyc in handle_endtag(self, tag)
255 self._go_up()
256 else:
--> 257 self.cur = self.cur.parent
258
259 #-------------------------------------------------------------------------

Here's the actual html code (I don't know if I can attach files)

Regions - Online Help - EN

Home

>

Welcome

>

Reporting

>

Regions

Regions

This demographic report allows you to view the regional breakdown of mentions by country.

Viewed via the

icon in the

Icon Panel

. It can also be viewed by double-clicking on the

Summary Dashboard

and selecting the appropriate option. This has two components,

Report

and

Data Explorer

.

Report

You can change the way that the mentions are displayed using the drop down list accessed via the

icon.

Data Explorer

The

Data Explorer

displays the mentions that make up the data shown in the

Report

panel. In addition there is the ability to filter the mentions by country via the filter located to the right of the

Email

button.