socket.error
Gustaf Liljegren
gustafl at algonet.se
Fri Feb 16 18:02:50 EST 2001
I'm using 1.5.2 in Windows 98.
When running the httplib module I get the following error when using a non-
existing host name:
Traceback (innermost last):
File "httptest.py", line 28, in ?
h = httplib.HTTP(domain)
File "d:\python\Lib\httplib.py", line 51, in __init__
if host: self.connect(host, port)
File "d:\python\Lib\httplib.py", line 79, in connect
self.sock.connect(host, port)
File "<string>", line 1, in connect
socket.error: host not found
The code to produce this error is simply:
import httplib
h = httplib.HTTP('www.nonvalidhost.com')
Python doesn't seem to like when I write "except socket.error:", so I
wonder how to handle it properly.
Regards,
Gustaf Liljegren
More information about the Python-list
mailing list