Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97327

Python: import requests gets a lot errors MacOS

$
0
0

New to programming and followed this course: https://www.youtube.com/watch?v=4F2m91eKmts&feature=emb_logo

When things went to Webscraping, got errors:

Code says:

import requests
from bs4 import BeautifulSoup
page = requests.get('https://forecast.weather.gov/MapClick.php?lat=34.05349000000007&lon=-118.24531999999999')

soup = BeautifulSoup(page.content, 'html.parser')
print(soup.find_all('a'))

Return is:

File "/Users/.../python/cleverprogrammer/webscraping.py", line 1, in import requests File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/requests/init.py", line 112, in from . import utils File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/requests/utils.py", line 26, in from ._internal_utils import to_native_string File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/requests/_internal_utils.py", line 11, in from .compat import is_py2, builtin_str, str File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/requests/compat.py", line 59, in from http import cookiejar as cookielib File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/cookiejar.py", line 39, in from calendar import timegm ImportError: cannot import name 'timegm' from 'calendar' (/Users/.../python/cleverprogrammer/calendar.py)

Is there some problem with the way Requests are installed? Maybe use of pipenv is not the correct way? And why does it call for calendar.py file and 'timegm'? Calendar.py is different file from the same course, in same folder.

What are the steps, that I can take, to get rid of these messages and get working Requests?

Thanks in advance.


Viewing all articles
Browse latest Browse all 97327

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>