Mechanize hanging

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Jan 22 22:49:38 CET 2009


En Wed, 21 Jan 2009 23:21:06 -0200, K-Dawg <kdawg44 at gmail.com> escribió:

> I am trying to use mechanize to connect and log into Yahoo!
>
> Here is my code:
>
> #c:\Python25\python
> import re
> import urllib
> import urllib2
> import mechanize
>
> print "print1"
> br = mechanize.Browser()
> br.set_handle_robots(False)
> br.open("https://login.yahoo.com/config/login?")
>
> It is hanging at the open.  Eventually I have to just kill it and I get
> this:

Sockets are blocking by default - and never time out. See if mechanize has  
some way to set a timeout - otherwise you may try the code below, before  
anything else:
socket.setdefaulttimeout(60)

-- 
Gabriel Genellina




More information about the Python-list mailing list