Python final project - webscraper project


#1

Hello,

I’m having some trouble with my python final project. I’m trying to create a webscraper, at first, and I keep getting the following error when running the program through windows cmd: " return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: ‘charmap’ codec can’t encode character ‘\u2019’ in position 947: character maps to "

Here is the link to the code: https://gist.github.com/vlad2792/13a045a255c04d615e38c73b9b37df46#file-python-project

Can you please help with a fix for this?


#2

what python version are you using for the project?


#3

Python 3.5.2 |Anaconda 4.2.0 (64-bit)


#4

i ran your code, and i didn’t run into any issues, it perfectly output what it needs to:

https://gist.github.com/anonymous/84f65c58c0d013ecee214241be603b3c

I think you need to google this or ask the bs4 community


#5

I have googled it. I will try the bs4 community as well. Thanks.


#6

and using encoding to enforce utf8 didn’t work:

https://stackoverflow.com/questions/27092833/unicodeencodeerror-charmap-codec-cant-encode-characters


#7

I checked the fixes from the thread and ‘soup = BeautifulSoup(html_doc, ‘html.parser’).encode(“ascii”)’ actually worked. Thanks a lot for the help!


#8