Beautiful Soup Chocolate Project

https://www.codecademy.com/courses/learn-web-scraping/projects/chocolate-scraping-with-beautiful-soup

I’m stuck at the beginning of this project. My code so far:

import codecademylib3_seaborn
from bs4 import BeautifulSoup
import requests
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

webpage = requests.get(‘https://s3.amazonaws.com/codecademy-content/courses/beautifulsoup/cacao/index.html’)
soup = BeautifulSoup(webpage.content, ‘html.parser’)
print(soup)

When I run it I get this error message:

Traceback (most recent call last):
File “script.py”, line 10, in
print(soup)
UnicodeEncodeError: ‘ascii’ codec can’t encode character ‘\xa0’ in position 991: ordinal not in range(128)

1 Like

Hi @skaihat,

The soup object is of type <class 'bs4.BeautifulSoup'>. Though instruction 4 does invite you to print that object, it is not really ideal for such output. At position 991, a character was encountered that the print function could not process properly. You can safely skip that step and complete the project without that problematic print statement.

2 Likes

I understand, thank you very much.

1 Like