A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-June/025930.html below:

[Python-Dev] Minor socket timeout quibble

[Python-Dev] Minor socket timeout quibble - timeout raises socket.error [Python-Dev] Minor socket timeout quibble - timeout raises socket.errorSteve Holden sholden@holdenweb.com
Tue, 25 Jun 2002 12:21:48 -0400
----- Original Message -----
From: "Skip Montanaro" <skip@pobox.com>
To: <python-dev@python.org>
Sent: Monday, June 24, 2002 9:53 PM
Subject: [Python-Dev] Minor socket timeout quibble - timeout raises
socket.error


>
> I just noticed in the development docs that when a timeout on a socket
> occurs, socket.error is raised.  I rather liked the idea that a different
> exception was raised for timeouts (I used Tim O'Malley's timeout_socket
> module).  Making a TimeoutError exception a subclass of socket.error would
> be fine so you can catch it with existing code, but I could see recovering
> differently for a timeout as opposed to other possible errors:
>
>     sock.settimeout(5.0)
>     try:
>         data = sock.recv(8192)
>     except socket.TimeoutError:
>         # maybe requeue the request
>         ...
>     except socket.error, codes:
>         # some more drastic solution is needed
>         ...
>

This seems logical: the timeout is inherently different, so a separate
"except" seems better than having to analyze the reason of the socket error.

regards
-----------------------------------------------------------------------
Steve Holden                                 http://www.holdenweb.com/
Python Web Programming                http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------







RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4