On Sat, Mar 24, 2012 at 11:51, Tomáš Hnyk <tomash...@gmail.com> wrote:
>
> and it has been hanging at this for about two minutes now and counting.
> Should not it raise some sort of exception, or is it going to wait for
> something indefinitely?

:-/
It's very possible that it will wait until the end of time, I fear.

> I was originally asking if there were a way to set a timeout to retrieving
> film info. Is there some internal timeout in imdbpy after which it justs
> gives up?

My fault: I misunderstood the problem.
No, IMDbPY uses urllib, and it doesn't provide a way to set
a timeout.  urllib2 has it, but only in very recent python versions,
so I'd prefer not to use it (and, by the way, a conversion from urllib
to urllib2 would take me some time).

> I found a way to do this on in internet:
> import signal

Yes, it's more or less reasonable, but I want to think twice about
it, before I introduce an alarm in the IMDbPY code... after
all i's a library and it could heavily interfere with signal handling
made by the programs that uses it. :-(

Real point is, it's very strange that it happens so methodically on
your system... I think I've never seen it hangs during a request.

Anyway, if you can try to put _before_ IMDb is imported/instanced this:
  import socket
  socket.setdefaulttimeout(10)

With that, at least the 'open' should fail after at most 10 seconds.
If this doesn't work for you, it means that the connection is established,
but hangs (or is really slow) reading the data.
If it's so, I fear an alarm-based solution is the only way... :-/

Thanks for the debugging!

-- 
Davide Alberani <davide.alber...@gmail.com>  [PGP KeyID: 0x465BFD47]
http://www.mimante.net/

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Imdbpy-help mailing list
Imdbpy-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-help

Reply via email to