title: Python bs4 'bytes' object has no attribute 'prettify'
body: <p>I've recently tried to pull data from a website but it seems that I get an error which I can't solve on my own. So I started looking around to see if any other people had my exact same error and I found 3 to be precise, I tried all 3 solutions and a couple more but nothin seems to work.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import bs4
  from time import sleep
  import requests
  import os
  import sys
  import io
  
  sys.stdout = io.TextIOWrapper(sys.stdout.buffer,'cp437','backslashreplace')
  
  f = open('output.txt', 'w')
  f.close()
  project_name = 'reddit'
  url = 'https://www.reddit.com/'
  html = requests.get(url)
  soup = bs4.BeautifulSoup(html.text, 'html.parser').encode('utf-8')
  
  print(soup.prettify())
  </code></pre>
  
  <p>As you can see I tried <code>sys.stdout = io.TextIOWrapper(sys.stdout.buffer,'cp437','backslashreplace')</code> which was suggested by someone else on another thread but unfortunately it did not work in my case.</p>
  
  <p>If anyone around know the solution it would be very much appreciated, thanks in advance.</p>
  
  <p>Naomi, </p>