requests-html icon indicating copy to clipboard operation
requests-html copied to clipboard

SyntaxError: invalid syntax

Open Natsu-2 opened this issue 5 years ago • 3 comments

whenever i try to import requests_html i get this error--> Traceback (most recent call last): File "F:/python programs/ne.py", line 115, in import requests_html File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests_html.py", line 13, in from fake_useragent import UserAgent File "E:\PyCharm Community Edition 2020.1.1\index\heloo\lib\site-packages\fake_useragent_init_.py", line 4, in from fake_useragent.fake import FakeUserAgent, UserAgent # noqa # isort:skip File "E:\PyCharm Community Edition 2020.1.1\index\heloo\lib\site-packages\fake_useragent\fake.py", line 10, in from fake_useragent.utils import load, load_cached, str_types, update File "E:\PyCharm Community Edition 2020.1.1\index\heloo\lib\site-packages\fake_useragent\utils.py", line 15, in from urllib2 import urlopen, Request, URLError File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib2.py", line 220 raise AttributeError, attr ^ SyntaxError: invalid syntax

Natsu-2 avatar Sep 08 '20 12:09 Natsu-2

which python version are you running?

TotallyNotChase avatar Sep 25 '20 18:09 TotallyNotChase

whenever i try to import requests_html i get this error--> Traceback (most recent call last): File "F:/python programs/ne.py", line 115, in import requests_html File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests_html.py", line 13, in from fake_useragent import UserAgent File "E:\PyCharm Community Edition 2020.1.1\index\heloo\lib\site-packages\fake_useragent__init__.py", line 4, in from fake_useragent.fake import FakeUserAgent, UserAgent # noqa # isort:skip File "E:\PyCharm Community Edition 2020.1.1\index\heloo\lib\site-packages\fake_useragent\fake.py", line 10, in from fake_useragent.utils import load, load_cached, str_types, update File "E:\PyCharm Community Edition 2020.1.1\index\heloo\lib\site-packages\fake_useragent\utils.py", line 15, in from urllib2 import urlopen, Request, URLError File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib2.py", line 220 raise AttributeError, attr ^ SyntaxError: invalid syntax

Try for python 3.8 64 bit install this 64-bit version and then try it. Upgrade your pip using (pip install --upgrade pip) then try for reinstall (pip install requests-html) almost your error should be cleared.

YashVadhadiya avatar Nov 10 '20 05:11 YashVadhadiya

whenever i try to import requests_html i get this error--> Traceback (most recent call last): File "F:/python programs/ne.py", line 115, in import requests_html File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests_html.py", line 13, in from fake_useragent import UserAgent File "E:\PyCharm Community Edition 2020.1.1\index\heloo\lib\site-packages\fake_useragent__init__.py", line 4, in from fake_useragent.fake import FakeUserAgent, UserAgent # noqa # isort:skip File "E:\PyCharm Community Edition 2020.1.1\index\heloo\lib\site-packages\fake_useragent\fake.py", line 10, in from fake_useragent.utils import load, load_cached, str_types, update File "E:\PyCharm Community Edition 2020.1.1\index\heloo\lib\site-packages\fake_useragent\utils.py", line 15, in from urllib2 import urlopen, Request, URLError File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib2.py", line 220 raise AttributeError, attr ^ SyntaxError: invalid syntax

Your syntax for requests_html is replaced by requests-html for install this try to run (pip install requests-html)

YashVadhadiya avatar Nov 10 '20 06:11 YashVadhadiya