google-code-export / feedparser

Automatically exported from code.google.com/p/feedparser
Other
1 stars 0 forks source link

feedparser.parse() with Python 3 and missing sgmllib: UnboundLocalError #385

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If Python 3 is used and user forgets to rename sgmllib3.py to sgmllib.py, then 
feedparser.py will set _SGML_AVAILABLE to 0, and feedparser.parse() function 
will cause UnboundLocalError, resulting in many errors in test suite.

Example:

======================================================================
ERROR: test_001000 (__main__.TestLooseParser)
./tests/wellformed/atom/entry_summary.xml: entry summary
----------------------------------------------------------------------
Traceback (most recent call last):
  File "feedparsertest.py", line 754, in <lambda>
    self.failUnlessEval(xmlfile, evalString)
  File "feedparsertest.py", line 164, in failUnlessEval
    env = feedparser.parse(xmlfile)
  File "../build/lib/feedparser.py", line 4012, in parse
    result['feed'] = feedparser.feeddata
UnboundLocalError: local variable 'feedparser' referenced before assignment

======================================================================

Original issue reported on code.google.com by Arfrever...@gmail.com on 18 Dec 2012 at 12:43

GoogleCodeExporter commented 9 years ago
That is true. I haven't made that a high priority because it's a quick fix on 
the user's side. I will work to fix this as soon as I have an opportunity.

Original comment by kurtmckee on 18 Dec 2012 at 3:17