Can anyone help me on the issue of downloading multiple files? For a while, it will stop me with **IOError** and told me connection attempt failed. I tried to use *time.sleep* function to sleep for random seconds but it doesn't help. And when I re-run the code, it starts to download files again. Any solutions?

![IO_Error](https://i.stack.imgur.com/VQfYS.png)

```
import urllib
import time
import random

index_list=["index#1","index#2",..."index#n"]

for n in index_list:
    u=urllib.urlopen("url_address"+str(n)+".jpg")
    data=u.read()   
    f=open("tm"+str(n)+".jpg","wb")
    f.write(data)
    t=random.uniform(0,1)*10
    print "system sleep time is ", t, " seconds"
    time.sleep(t)

```