Why this exception catch doesn't work?? (python 3)
Dodo
dodo_do_not_wake_up at yahoo.Fr
Tue Apr 20 06:40:15 EDT 2010
Hello,
I don't understand why this won't execute
import urllib.request as u
import socket
socket.setdefaulttimeout(10)
l = "http://img144.imageshack.us/my.php?image=koumakandg8.jpg" #
supposed to timeout
try:
h = u.urlretrieve(l)
except u.URLError, e: # I tried u.e too, no effect.
print(e)
except:
print("other error")
The error :
...\Python>err.py
File "...\err.py", line 8
except u.URLError, e: # I tried u.e too, no effect.
^
SyntaxError: invalid syntax
Dorian
More information about the Python-list
mailing list