2009-03-27

Time-out in Africa

Yesterday, while listening to "White Car in Germany" by The Associates, I kept getting an error while running buildout:
Error: MD5 validation failed for plone.app.locales-3.2.0.zip;
"What the hell", I thought and went step-debugging into the code. First an observation: I would not expect a ``check_md5`` method to actually go ahead and unlink the downloaded file if validation fails. That aside, the error persisted and it turns out that ``urllib2`` silently times out a request if the socket does not receive data within some period of time (this happens quite often here).

The documentation suggests that it will raise an exception, but perhaps the clue is that if no time-out value has been set, it's really not a time-out (so why raise an exception). At least, setting it (at a reasonable location in the buildout-script) resolves the issue:
import socket
socket.setdefaulttimeout(3600)

2 comments:

Stefan Eletzhofer said...

There's a "-t" option in buildut for that.

Thus,

$ bin/buildout -c foo.cfg -t 5

sets a 5 second timeout.

ToutPT said...

What is the name of this option to put it under ~/.buildout/default file ?