urllib.urlopen() freezes unexpectedly

Christos TZOTZIOY Georgiou tzot at sil-tec.gr
Mon Jun 7 05:51:09 EDT 2004


On Mon, 07 Jun 2004 12:37:43 +0300, rumours say that Christodoulos
Fragoudakis <chfrag at central.ntua.gr> might have written:

[replied in Greek, repeating here in English]

>Hello everyone! Can someone help us with the following problem:

[snip: urllib.urlopen occasionally freezes; it doesn't seem to be
Python-specific, since a browser also freezes now and then for the same
url]

>How can we time the operation and stop it after a specified time 
>interval? Do threads help and how?

The urllib module uses the builtin socket module; the
socket.setdefaulttimeout function will allow you to make the connection
abort after a timeout.

Please let us know if that worked.
-- 
TZOTZIOY, I speak England very best,
"I have a cunning plan, m'lord" --Sean Bean as Odysseus/Ulysses



More information about the Python-list mailing list