ftp seems to get a delayed reaction.

Antoon Pardon apardon at forel.vub.ac.be
Tue Jan 6 09:53:12 CET 2009

I'm not sure if this is a python problem or something else.
I'm trying with the use of ftplib to get a dump on a remote machine.
The dump mirrors the directory structure but instead of the files
a bziped tar file is made and transferred.

While mirroring the directory structure I don't care to check which
directories are already present. I just try to make the directory
and catch the exception when it occurs. This worked fine until now.

I recently movade the script to a new computer and use a different
ftp server. Now it seems the error code for the ftp.mkd is received
by the storbinary later on.

This is the traceback:

Traceback (most recent call last):
  File "ftpdump", line 141, in <module>
  File "ftpdump", line 133, in main
  File "ftpdump", line 90, in process
    ftp.storbinary("STOR %s\n" % pj(cprt, "!ENTRY-tbz"), fl)
  File "/usr/lib/python2.5/ftplib.py", line 425, in storbinary
    self.voidcmd('TYPE I')
  File "/usr/lib/python2.5/ftplib.py", line 246, in voidcmd
    return self.voidresp()
  File "/usr/lib/python2.5/ftplib.py", line 221, in voidresp
    resp = self.getresp()
  File "/usr/lib/python2.5/ftplib.py", line 216, in getresp
    raise error_perm, resp
ftplib.error_perm: 521 "/tmpstor/rcpc42/bin" directory exists

This is part of the code:

# Somethings define somewhere above
# pj = os.path.join
# FTPProblem = ftplib.error_temp

      while problem:
          ftp.storbinary("STOR %s\n" % pj(cprt, "!ENTRY-tbz"), fl)
          problem = False
        except FTPProblem:
          warn ("reconnecting for %s\n" % cprt)
          except Exception:

So what seems to happen is that I call the ftp.storbinary and that
I get the mesg: ftplib.error_perm: 521 "/tmpstor/rcpc42/bin" directory exists
That I should have gotten while doing the ftp.mkd earlier.

Can someone shed some light on how to deal with this?

Antoon Pardon

More information about the Python-list mailing list