Running this code:
from bs4 import BeautifulSoup soup = BeautifulSoup (open("my.html")) print(soup.prettify()) Produces this error:
Traceback (most recent call last): File "soup.py", line 5, in <module> print(soup.prettify()) File "C:\Python33\lib\encodings\cp437.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_map)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u25ba' in position 9001: character maps to <undefined> I then tried:
print(soup.encode('UTF-8').prettify()) But this fails on account of string formatting with a bytes object:
Traceback (most recent call last): File "soup.py", line 11, in <module> print(soup.encode('UTF-8').prettify()) AttributeError: 'bytes' object has no attribute 'prettify' Not sure how to go about solving this. Any input would be greatly appreciated.