hey Iskendar, I added the import os code into my program but I'm still getting the same error. I'm running ubuntu on a virtual machine and my program is trying to open a lot of urls to try and scrape song lyrics from a site.
from bs4 import BeautifulSoup
os.environ['http_proxy'] = ''
from urllib.request import urlopen
from urllib.request import urlretrieve
base = "http://www.hymnal.net/hymn.php/"
ns_urls = 
#this while loop places all the urls for all the new songs into a list
ns = 1
while ns < 391:
addr = "ns/" + str(ns)
ns_urls.append(base + addr)
ns += 1
ns_songs = 
count = 1
#this for loop parses the html found in the urls and places the lyrics into a list
for url in ns_urls:
soup = BeautifulSoup(urlopen(url))
count += 1
"""the counter here is see on which url the error arises.
from what I've seen it changes everytime but is usually around 20 - 40.
for tag in soup.find_all('div'):
if tag['class'] == 'main-content':
str_tag = str(tag)