FTPLIB - retry files?

Discussion in 'Python' started by Peter A. Schott, Jan 17, 2005.

  1. 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.

    Not exactly sure how to go about that right now short of moving the files
    elsewhere and then queuing them up again.

    Anyone done this? I'm still kind of new to this so am open to suggestions on
    how this might be possible as well.

    Thanks for your help.

    -Pete Schott
     
    Peter A. Schott, Jan 17, 2005
    #1
    1. Advertising

  2. 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
     
    Mark McEahern, Jan 17, 2005
    #2
    1. Advertising

  3. That will probably work. I'll have to do some playing around with it. I'm
    still new to all of this but am finding that it can handle a lot of the
    functionality I'm looking for: Logging, retries, archiving, etc.

    I will try to integrate this and see what happens.

    Thanks.

    -Pete

    Mark McEahern <> wrote:

    > 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
     
    Peter A. Schott, Jan 19, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    780
    Steve Holden
    Sep 12, 2003
  2. Peter A. Schott
    Replies:
    0
    Views:
    281
    Peter A. Schott
    Aug 23, 2005
  3. Thierry Lam

    Renaming files in ftplib

    Thierry Lam, Jan 6, 2006, in forum: Python
    Replies:
    2
    Views:
    605
  4. Peter A. Schott
    Replies:
    1
    Views:
    497
    Martin Franklin
    Jan 18, 2006
  5. Gabriel Genellina
    Replies:
    0
    Views:
    442
    Gabriel Genellina
    Jan 25, 2007
Loading...

Share This Page