0
votes

I have a script that I found on the internet that worked in Python 3.4, but not Python 3.5. I'm not too familiar in python, but it has the

#!/usr/bin/env python3

schlebang at the top of the file. And it also throws this exception when I try to run it:

Traceback (most recent call last):

File "/home/username/folder/script.py", line 18, in

doc = opener.open(url)

File "/usr/lib/python3.5/urllib/request.py", line 472, in open

response = meth(req, response)

File "/usr/lib/python3.5/urllib/request.py", line 582, in http_response 'http', request, response, code, msg, hdrs)

File "/usr/lib/python3.5/urllib/request.py", line 504, in error

result = self._call_chain(*args)

File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain

result = func(*args)

File "/usr/lib/python3.5/urllib/request.py", line 968, in http_error_401 url, req, headers)

File "/usr/lib/python3.5/urllib/request.py", line 921, in http_error_auth_reqed

return self.retry_http_basic_auth(host, req, realm)

File "/usr/lib/python3.5/urllib/request.py", line 931, in retry_http_basic_auth

return self.parent.open(req, timeout=req.timeout)

File "/usr/lib/python3.5/urllib/request.py", line 472, in open

response = meth(req, response)

File "/usr/lib/python3.5/urllib/request.py", line 582, in http_response 'http', request, response, code, msg, hdrs)

File "/usr/lib/python3.5/urllib/request.py", line 510, in error return self._call_chain(*args)

File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain result = func(*args)

File "/usr/lib/python3.5/urllib/request.py", line 590, in http_error_default

raise HTTPError(req.full_url, code, msg, hdrs, fp)

Python isn't really my preferred langage, so I don't know what to do. This is a script that's supposed to access my Gmail account and pull new mails from it. Do you guys have any suggestions? I'm using Arch Linux, if that helps.

1
What is the actual exception?Ignacio Vazquez-Abrams
I think it's urllib.error.HTTPError: HTTP Error 401: Unauthorizedmaninthecomputer
with that error it is very unlikely that running it under 3.4 will change anythingAzsgy

1 Answers

2
votes

Variant A:
Run this script as python3.4 /path/to/script

Variant B:
Change the schebang to #!/usr/bin/python3.4