HaveF / feedparser

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

Undeclared namespace with libxml2 throwing UndeclaredNamespace #377

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. git clone https://code.google.com/p/feedparser
2. cd feedparser/feedparser
3. python2.7 feedparsertest.py

What is the expected output? What do you see instead?

I'd expect all 4247 tests to pass.  13 of them fail.  One produces 

What version of the product are you using? On what operating system?

git head; Ubuntu 12.10

Please provide any additional information below.

======================================================================
ERROR: test_002064 (__main__.TestCase)
./tests/illformed/undeclared_namespace.xml: undeclared namespace
----------------------------------------------------------------------
Traceback (most recent call last):
  File "feedparsertest.py", line 749, in <lambda>
    self.failUnlessEval(xmlfile, evalString)
  File "feedparsertest.py", line 162, in failUnlessEval
    env = feedparser.parse(xmlfile)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3975, in parse
    saxparser.parse(source)
  File "/usr/lib/python2.7/dist-packages/drv_libxml2.py", line 208, in parse
    eltName,eltQName,attributesNSImpl)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 1800, in startElementNS
    raise UndeclaredNamespace, "'%s' is not associated with a namespace" % givenprefix
UndeclaredNamespace: 'itunes' is not associated with a namespace

======================================================================
ERROR: test_001850 (__main__.TestEncodings)
./tests/encoding/x80_ebcdic_cp_ca.xml: x80 character in ebcdic_cp_ca encoding
----------------------------------------------------------------------
Traceback (most recent call last):
  File "feedparsertest.py", line 749, in <lambda>
    self.failUnlessEval(xmlfile, evalString)
  File "feedparsertest.py", line 162, in failUnlessEval
    env = feedparser.parse(xmlfile)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3941, in parse
    data, result['encoding'], error = convert_to_utf8(http_headers, data)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3743, in convert_to_utf8
    chardet_encoding = unicode(chardet.detect(data)['encoding'], 'ascii', 'ignore')
TypeError: coercing to Unicode: need string or buffer, NoneType found

======================================================================
ERROR: test_001852 (__main__.TestEncodings)
./tests/encoding/x80_ebcdic-cp-ch.xml: x80 character in ebcdic-cp-ch encoding
----------------------------------------------------------------------
Traceback (most recent call last):
  File "feedparsertest.py", line 749, in <lambda>
    self.failUnlessEval(xmlfile, evalString)
  File "feedparsertest.py", line 162, in failUnlessEval
    env = feedparser.parse(xmlfile)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3941, in parse
    data, result['encoding'], error = convert_to_utf8(http_headers, data)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3743, in convert_to_utf8
    chardet_encoding = unicode(chardet.detect(data)['encoding'], 'ascii', 'ignore')
TypeError: coercing to Unicode: need string or buffer, NoneType found

======================================================================
ERROR: test_001885 (__main__.TestEncodings)
./tests/encoding/x80_ebcdic_cp_ch.xml: x80 character in ebcdic_cp_ch encoding
----------------------------------------------------------------------
Traceback (most recent call last):
  File "feedparsertest.py", line 749, in <lambda>
    self.failUnlessEval(xmlfile, evalString)
  File "feedparsertest.py", line 162, in failUnlessEval
    env = feedparser.parse(xmlfile)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3941, in parse
    data, result['encoding'], error = convert_to_utf8(http_headers, data)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3743, in convert_to_utf8
    chardet_encoding = unicode(chardet.detect(data)['encoding'], 'ascii', 'ignore')
TypeError: coercing to Unicode: need string or buffer, NoneType found

======================================================================
ERROR: test_001889 (__main__.TestEncodings)
./tests/encoding/x80_ebcdic_cp_be.xml: x80 character in ebcdic_cp_be encoding
----------------------------------------------------------------------
Traceback (most recent call last):
  File "feedparsertest.py", line 749, in <lambda>
    self.failUnlessEval(xmlfile, evalString)
  File "feedparsertest.py", line 162, in failUnlessEval
    env = feedparser.parse(xmlfile)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3941, in parse
    data, result['encoding'], error = convert_to_utf8(http_headers, data)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3743, in convert_to_utf8
    chardet_encoding = unicode(chardet.detect(data)['encoding'], 'ascii', 'ignore')
TypeError: coercing to Unicode: need string or buffer, NoneType found

======================================================================
ERROR: test_001900 (__main__.TestEncodings)
./tests/encoding/x80_ebcdic-cp-ca.xml: x80 character in ebcdic-cp-ca encoding
----------------------------------------------------------------------
Traceback (most recent call last):
  File "feedparsertest.py", line 749, in <lambda>
    self.failUnlessEval(xmlfile, evalString)
  File "feedparsertest.py", line 162, in failUnlessEval
    env = feedparser.parse(xmlfile)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3941, in parse
    data, result['encoding'], error = convert_to_utf8(http_headers, data)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3743, in convert_to_utf8
    chardet_encoding = unicode(chardet.detect(data)['encoding'], 'ascii', 'ignore')
TypeError: coercing to Unicode: need string or buffer, NoneType found

======================================================================
ERROR: test_001944 (__main__.TestEncodings)
./tests/encoding/x80_ebcdic-cp-be.xml: x80 character in ebcdic-cp-be encoding
----------------------------------------------------------------------
Traceback (most recent call last):
  File "feedparsertest.py", line 749, in <lambda>
    self.failUnlessEval(xmlfile, evalString)
  File "feedparsertest.py", line 162, in failUnlessEval
    env = feedparser.parse(xmlfile)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3941, in parse
    data, result['encoding'], error = convert_to_utf8(http_headers, data)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3743, in convert_to_utf8
    chardet_encoding = unicode(chardet.detect(data)['encoding'], 'ascii', 'ignore')
TypeError: coercing to Unicode: need string or buffer, NoneType found

======================================================================
ERROR: test_001945 (__main__.TestEncodings)
./tests/encoding/x80_ebcdic_cp_nl.xml: x80 character in ebcdic_cp_nl encoding
----------------------------------------------------------------------
Traceback (most recent call last):
  File "feedparsertest.py", line 749, in <lambda>
    self.failUnlessEval(xmlfile, evalString)
  File "feedparsertest.py", line 162, in failUnlessEval
    env = feedparser.parse(xmlfile)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3941, in parse
    data, result['encoding'], error = convert_to_utf8(http_headers, data)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3743, in convert_to_utf8
    chardet_encoding = unicode(chardet.detect(data)['encoding'], 'ascii', 'ignore')
TypeError: coercing to Unicode: need string or buffer, NoneType found

======================================================================
ERROR: test_001985 (__main__.TestEncodings)
./tests/encoding/x80_ebcdic-cp-wt.xml: x80 character in ebcdic-cp-wt encoding
----------------------------------------------------------------------
Traceback (most recent call last):
  File "feedparsertest.py", line 749, in <lambda>
    self.failUnlessEval(xmlfile, evalString)
  File "feedparsertest.py", line 162, in failUnlessEval
    env = feedparser.parse(xmlfile)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3941, in parse
    data, result['encoding'], error = convert_to_utf8(http_headers, data)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3743, in convert_to_utf8
    chardet_encoding = unicode(chardet.detect(data)['encoding'], 'ascii', 'ignore')
TypeError: coercing to Unicode: need string or buffer, NoneType found

======================================================================
ERROR: test_001991 (__main__.TestEncodings)
./tests/encoding/x80_ebcdic_cp_wt.xml: x80 character in ebcdic_cp_wt encoding
----------------------------------------------------------------------
Traceback (most recent call last):
  File "feedparsertest.py", line 749, in <lambda>
    self.failUnlessEval(xmlfile, evalString)
  File "feedparsertest.py", line 162, in failUnlessEval
    env = feedparser.parse(xmlfile)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3941, in parse
    data, result['encoding'], error = convert_to_utf8(http_headers, data)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3743, in convert_to_utf8
    chardet_encoding = unicode(chardet.detect(data)['encoding'], 'ascii', 'ignore')
TypeError: coercing to Unicode: need string or buffer, NoneType found

======================================================================
ERROR: test_002017 (__main__.TestEncodings)
./tests/encoding/x80_ebcdic-cp-nl.xml: x80 character in ebcdic-cp-nl encoding
----------------------------------------------------------------------
Traceback (most recent call last):
  File "feedparsertest.py", line 749, in <lambda>
    self.failUnlessEval(xmlfile, evalString)
  File "feedparsertest.py", line 162, in failUnlessEval
    env = feedparser.parse(xmlfile)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3941, in parse
    data, result['encoding'], error = convert_to_utf8(http_headers, data)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3743, in convert_to_utf8
    chardet_encoding = unicode(chardet.detect(data)['encoding'], 'ascii', 'ignore')
TypeError: coercing to Unicode: need string or buffer, NoneType found

======================================================================
ERROR: test_002019 (__main__.TestEncodings)
./tests/encoding/x80_ebcdic-cp-us.xml: x80 character in ebcdic-cp-us encoding
----------------------------------------------------------------------
Traceback (most recent call last):
  File "feedparsertest.py", line 749, in <lambda>
    self.failUnlessEval(xmlfile, evalString)
  File "feedparsertest.py", line 162, in failUnlessEval
    env = feedparser.parse(xmlfile)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3941, in parse
    data, result['encoding'], error = convert_to_utf8(http_headers, data)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3743, in convert_to_utf8
    chardet_encoding = unicode(chardet.detect(data)['encoding'], 'ascii', 'ignore')
TypeError: coercing to Unicode: need string or buffer, NoneType found

======================================================================
ERROR: test_002028 (__main__.TestEncodings)
./tests/encoding/x80_ebcdic_cp_us.xml: x80 character in ebcdic_cp_us encoding
----------------------------------------------------------------------
Traceback (most recent call last):
  File "feedparsertest.py", line 749, in <lambda>
    self.failUnlessEval(xmlfile, evalString)
  File "feedparsertest.py", line 162, in failUnlessEval
    env = feedparser.parse(xmlfile)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3941, in parse
    data, result['encoding'], error = convert_to_utf8(http_headers, data)
  File "/home/barry/projects/ubuntu/feedparser/upstream/feedparser/feedparser.py", line 3743, in convert_to_utf8
    chardet_encoding = unicode(chardet.detect(data)['encoding'], 'ascii', 'ignore')
TypeError: coercing to Unicode: need string or buffer, NoneType found

----------------------------------------------------------------------
Ran 4247 tests in 7.752s

FAILED (errors=13)

Original issue reported on code.google.com by war...@gmail.com on 27 Sep 2012 at 8:46

GoogleCodeExporter commented 9 years ago
Thanks for this traceback, Barry! I recently upgraded my computer and 
discovered the chardet bug and fixed that, so 12 of the 13 should go away. I'll 
have to investigate why your test machine isn't switching to sgmllib-based 
parsing for that first error, though.

Can you provide me the libxml2-related version numbers so I can try recreating 
that situation?

Original comment by kurtmckee on 19 Nov 2012 at 3:56

GoogleCodeExporter commented 9 years ago
Okay, after reviewing more bug reports I see that (with only the one remaining 
error) this is a duplicate of 362.

Original comment by kurtmckee on 19 Nov 2012 at 4:52