FTPLIB - retry files?

Mark McEahern marklists at mceahern.com
Mon Jan 17 15:25:00 EST 2005


Peter A.Schott wrote:

> Is there any way to retry sending files with some delay up to a set 
> number on
> failure?  Sometimes we encounter a locked file on our server or the 
> destination
> server and we want to retry that file in X seconds.
>  
>
In general, what's wrong with this:

import time

retryCount = 10
retrySleep = 5
for x in range(retryCount):
   try:
       [ftp commands]
   except [ftp exceptions]:
       time.sleep(retrySleep)
   else:
       break

// m




More information about the Python-list mailing list