Martijn Pieters added the comment:

This changes causes printing BeautifulSoup NavigableString objects to fail; the 
code actually could never work as `unicode.__getslice__` insists on getting 
passed in integers, not None.

To reproduce, create a new file in IDLE and paste in:

from bs4 import BeautifulSoup
html_doc = """<title>The Dormouse's story</title>""" 
soup = BeautifulSoup(html_doc)
print soup.title.string

Then pick *Run Module* to see:

Traceback (most recent call last):
  File "/private/tmp/test.py", line 4, in <module>
    print soup.title.string
  File 
"/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/idlelib/PyShell.py",
 line 1353, in write
    s = unicode.__getslice__(s, None, None)
TypeError: an integer is required

The same error can be induced with:

    unicode.__getslice__(u'', None, None)

while specifying a start and end index (0 and len(s)) should fix this.

----------
nosy: +mjpieters

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19481>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to