Python: Control timeout length
<p>I have code similar to the following running in a script:</p>

<pre><code>try:
    s = ftplib.FTP('xxx.xxx.xxx.xxx','username','password')

except: 
    print ('Could not contact FTP serer')
    sys.exit()
</code></pre>

<p>IF the FTP site is inaccessible, the script almost seems to 'hang' ... It is taking about 75 seconds on average before sys.exit() appears to be called... I know the 75 seconds is probably  very subjective, and dependent on the system this runs on...but is there a way to have python just try this once, and if unsucessful, to exit immediately? The platform I am using for this is Mac OS X 10.5/python 2.5.1.</p>
