Re: [Python-Dev] Time-out in URL Open

2006-07-05 Thread Nick Craig-Wood
Alex Martelli <[EMAIL PROTECTED]> wrote: > What about doing it with a per-thread-timeout in TLS (overriding the > global one if a thread does have it set in its TLS)? Not as clean, > but perhaps far easier to implement than patching dozens of > modules/functions/classes to provide timeout= opt

Re: [Python-Dev] Time-out in URL Open

2006-07-05 Thread skip
Guido> OK, you've convinced me. Now where's that SF patch you were Guido> promising? :-) A starting point is probably the patch Georg referred to a couple days ago: Georg> There was one patch that did this: http://python.org/sf/723312. Alas, it's assigned to me and I let it get so s

Re: [Python-Dev] Time-out in URL Open

2006-07-05 Thread Alex Martelli
What about doing it with a per-thread-timeout in TLS (overriding the global one if a thread does have it set in its TLS)? Not as clean, but perhaps far easier to implement than patching dozens of modules/functions/classes to provide timeout= options everywhere... Alex On 7/5/06, Guido van Ross

Re: [Python-Dev] Time-out in URL Open

2006-07-05 Thread Guido van Rossum
OK, you've convinced me. Now where's that SF patch you were promising? :-) --Guido On 7/5/06, Facundo Batista <[EMAIL PROTECTED]> wrote: > 2006/7/4, Guido van Rossum <[EMAIL PROTECTED]>: > > > > This affect all the sockets. > > > > So, assuming your app is single-threaded, set the timeout, call >

Re: [Python-Dev] Time-out in URL Open

2006-07-05 Thread Facundo Batista
2006/7/4, Guido van Rossum <[EMAIL PROTECTED]>: > > This affect all the sockets. > > So, assuming your app is single-threaded, set the timeout, call > urlopen(), and reset the timeout to None. No, it's multithreaded, :D > > And I hit the problem when servicing > > information with a web service

Re: [Python-Dev] Time-out in URL Open

2006-07-04 Thread Guido van Rossum
On 7/4/06, Facundo Batista <[EMAIL PROTECTED]> wrote: > 2006/7/3, Guido van Rossum <[EMAIL PROTECTED]>: > > > To fake things like this, socket.setdefaulttimeout() was added, though > > I don't know if it actually works. Have you tried that? > > This affect all the sockets. So, assuming your app is

Re: [Python-Dev] Time-out in URL Open

2006-07-04 Thread Facundo Batista
2006/7/3, Guido van Rossum <[EMAIL PROTECTED]>: > To fake things like this, socket.setdefaulttimeout() was added, though > I don't know if it actually works. Have you tried that? This affect all the sockets. And I hit the problem when servicing information with a web service (TCPServer), and I ne

Re: [Python-Dev] Time-out in URL Open

2006-07-04 Thread Georg Brandl
[EMAIL PROTECTED] wrote: > Facundo> I need a timeout in urlopen, just to be able to make: > > urllib2.urlopen("http://no.host.org";, timeout=2) > > Facundo> This is actually not possible, but I'll make it work. > > Facundo> I want to know, please, if this is useful in genera

Re: [Python-Dev] Time-out in URL Open

2006-07-03 Thread John J Lee
On Mon, 3 Jul 2006, Guido van Rossum wrote: > To fake things like this, socket.setdefaulttimeout() was added, though > I don't know if it actually works. Have you tried that? [...] It works. I think there's some issue with SSL, though (can't seem to find the issue now). Of course, feeding thro

Re: [Python-Dev] Time-out in URL Open

2006-07-03 Thread skip
Guido> To fake things like this, socket.setdefaulttimeout() was added, Guido> though I don't know if it actually works. Have you tried that? I'm pretty sure it does, but is a rather blunt instrument for the task, as it affects all socket connections the app might make. Skip _

Re: [Python-Dev] Time-out in URL Open

2006-07-03 Thread skip
Facundo> I need a timeout in urlopen, just to be able to make: urllib2.urlopen("http://no.host.org";, timeout=2) Facundo> This is actually not possible, but I'll make it work. Facundo> I want to know, please, if this is useful in general, for me to Facundo> post a patch

Re: [Python-Dev] Time-out in URL Open

2006-07-03 Thread Guido van Rossum
To fake things like this, socket.setdefaulttimeout() was added, though I don't know if it actually works. Have you tried that? --Guido On 7/3/06, Facundo Batista <[EMAIL PROTECTED]> wrote: > I need a timeout in urlopen, just to be able to make: > > >>> urllib2.urlopen("http://no.host.org";, timeo

Re: [Python-Dev] Time-out in URL Open

2006-07-03 Thread Martin v. Löwis
Facundo Batista wrote: urllib2.urlopen("http://no.host.org";, timeout=2) > > This is actually not possible, but I'll make it work. > > I want to know, please, if this is useful in general, for me to post a > patch in SF. While it might be useful, it can only be added to Python 2.6 now. So t

Re: [Python-Dev] Time-out in URL Open

2006-07-03 Thread Fred L. Drake, Jr.
On Monday 03 July 2006 14:07, Facundo Batista wrote: > I want to know, please, if this is useful in general, for me to post a > patch in SF. It seems like something that should be easy, and lots of people need to consider this for applications. -Fred -- Fred L. Drake, Jr. _

[Python-Dev] Time-out in URL Open

2006-07-03 Thread Facundo Batista
I need a timeout in urlopen, just to be able to make: >>> urllib2.urlopen("http://no.host.org";, timeout=2) This is actually not possible, but I'll make it work. I want to know, please, if this is useful in general, for me to post a patch in SF. Regards, -- .Facundo Blog: http://www.tani