Code: Alles auswählen
powerbook:Python Simon$ cat urllib2-2.5.py
import urllib2
u = urllib2.urlopen('http://www.playlist.com/searchbeta/tracks#Buraka%20Som%20Sistema/1')
powerbook:Python Simon$ cat urllib2-3.0.py
import urllib.request, urllib.error, urllib.parse
u = urllib.request.urlopen('http://www.playlist.com/searchbeta/tracks#Buraka%20Som%20Sistema/1')
powerbook:Python Simon$ python2.5 urllib2-2.5.py
Traceback (most recent call last):
File "urllib2-2.5.py", line 3, in <module>
u = urllib2.urlopen('http://www.playlist.com/searchbeta/tracks#Buraka%20Som%20Sistema/1')
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py", line 121, in urlopen
return _opener.open(url, data)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py", line 380, in open
response = meth(req, response)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py", line 491, in http_response
'http', request, response, code, msg, hdrs)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py", line 418, in error
return self._call_chain(*args)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py", line 353, in _call_chain
result = func(*args)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib2.py", line 499, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found
powerbook:Python Simon$ python3.0 urllib2-3.0.py
Traceback (most recent call last):
File "urllib2-3.0.py", line 3, in <module>
u = urllib.request.urlopen('http://www.playlist.com/searchbeta/tracks#Buraka%20Som%20Sistema/1')
File "/Library/Frameworks/Python.framework/Versions/3.0/lib/python3.0/urllib/request.py", line 122, in urlopen
return _opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.0/lib/python3.0/urllib/request.py", line 364, in open
response = meth(req, response)
File "/Library/Frameworks/Python.framework/Versions/3.0/lib/python3.0/urllib/request.py", line 476, in http_response
'http', request, response, code, msg, hdrs)
File "/Library/Frameworks/Python.framework/Versions/3.0/lib/python3.0/urllib/request.py", line 402, in error
return self._call_chain(*args)
File "/Library/Frameworks/Python.framework/Versions/3.0/lib/python3.0/urllib/request.py", line 336, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.0/lib/python3.0/urllib/request.py", line 484, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found