I'm doing practice with the google-python course. However, I got problem with the urllib. Here is the simplified code:
import urllib
url = 'http://www.google.com'
ufile=urllib.urlopen(url)
This code actually works, but if I change the url to some other ones, like:
url = 'https://developers.google.com/edu/python/utilities#exceptions'
It will raise the error:
IOError: [Errno socket error] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
The full error information is as follows:
Traceback (most recent call last):
File "practice2.py", line 4, in <module>
ufile=urllib.urlopen(url)
File "/home/jren/Canopy/appdata/canopy-1.6.2.3262.rh5-x86_64/lib/python2.7/urllib.py", line 87, in urlopen
return opener.open(url)
File "/home/jren/Canopy/appdata/canopy-1.6.2.3262.rh5-x86_64/lib/python2.7/urllib.py", line 213, in open
return getattr(self, name)(url)
File "/home/jren/Canopy/appdata/canopy-1.6.2.3262.rh5-x86_64/lib/python2.7/urllib.py", line 443, in open_https
h.endheaders(data)
File "/home/jren/Canopy/appdata/canopy-1.6.2.3262.rh5-x86_64/lib/python2.7/httplib.py", line 1049, in endheaders
self._send_output(message_body)
File "/home/jren/Canopy/appdata/canopy-1.6.2.3262.rh5-x86_64/lib/python2.7/httplib.py", line 893, in _send_output
self.send(msg)
File "/home/jren/Canopy/appdata/canopy-1.6.2.3262.rh5-x86_64/lib/python2.7/httplib.py", line 855, in send
self.connect()
File "/home/jren/Canopy/appdata/canopy-1.6.2.3262.rh5-x86_64/lib/python2.7/httplib.py", line 1274, in connect
server_hostname=server_hostname)
File "/home/jren/Canopy/appdata/canopy-1.6.2.3262.rh5-x86_64/lib/python2.7/ssl.py", line 352, in wrap_socket
_context=self)
File "/home/jren/Canopy/appdata/canopy-1.6.2.3262.rh5-x86_64/lib/python2.7/ssl.py", line 579, in __init__
self.do_handshake()
File "/home/jren/Canopy/appdata/canopy-1.6.2.3262.rh5-x86_64/lib/python2.7/ssl.py", line 808, in do_handshake
self._sslobj.do_handshake()
IOError: [Errno socket error] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
Thank you very much to read this!