ftp seems to get a delayed reaction.

Antoon Pardon apardon at forel.vub.ac.be
Tue Jan 6 06:56:52 EST 2009


I have managed to prune the script, so I can post it here:

==========================================================

from ftplib import FTP

bckrt = "/tmpstor/rcpc42"

def process():
  print "making directory"
  try:
    ftp.mkd('ftp-tst')
    print "mkdir succeeded"
  except Exception, ErrMsg:
    print "mkdir failed: %s" % ErrMsg
  fl = open("tstfile")
  print "storing file"
  ftp.storbinary("STOR ftp-tst/ftp-file\n",  fl)
  fl.close()

ftp = FTP('ftphost', 'user', 'passwd')
ftp.set_pasv(False)
ftp.cwd(bckrt)

print "Doing once"
process()
print "Doing twice"
process()

----------------------------------------------------------
And this is the output:
==========================================================
Doing once
making directory
mkdir succeeded
storing file
Doing twice
making directory
mkdir failed: 500 '': command not understood.
storing file
Traceback (most recent call last):
  File "ftptst", line 24, in <module>
    process()
  File "ftptst", line 14, in process
    ftp.storbinary("STOR ftp-tst/ftp-file\n",  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/ftp-tst" directory exists




More information about the Python-list mailing list