This is a buggy interaction between IDLE and BeautifulSoup’s NavigableString
objects (which subclass unicode
). See issue 1757057; it’s been around for a while.
The work-around is to convert the object to a plain unicode value first:
print unicode(names)