[Tutor] ftplib error

benmarkwell at gmail.com benmarkwell at gmail.com
Wed Feb 22 17:52:59 CET 2006


I'm trying to write a backup script to put files on a server.

--This is how I have begun:


from ftplib import FTP

f = open(r'g:\dev\python\exercises\aaa.py', 'r')
fname = r'g:\dev\python\exercises\aaa.py'

ftp = FTP('ftp.xxxx.com')
ftp.login()

ftp.storlines('STOR ' + fname, f)
ftp.retrlines('LIST')
f.close()
ftp.close()
print 'success!'

-- And this is what gets returned to the prompt:


Traceback (most recent call last):
  File "G:\Dev\Python\Scripts\backup.py", line 14, in ?
    ftp.storlines('STOR ' + fname, f)
  File "F:\Python24\lib\ftplib.py", line 426, in storlines
    conn = self.transfercmd(cmd)
  File "F:\Python24\lib\ftplib.py", line 345, in transfercmd
    return self.ntransfercmd(cmd, rest)[0]
  File "F:\Python24\lib\ftplib.py", line 327, in ntransfercmd
    resp = self.sendcmd(cmd)
  File "F:\Python24\lib\ftplib.py", line 241, in sendcmd
    return self.getresp()
  File "F:\Python24\lib\ftplib.py", line 216, in getresp
    raise error_perm, resp
ftplib.error_perm: 550 g:\dev\python\exercises\aaa.py: The filename,
directory name, or volume label syntax is incorrect.

The filename and directory name is correct. I don't know about the volume
label syntax.
I've given up trying to find a solution.  All help appreciated.

Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060222/77301d1d/attachment.htm 


More information about the Tutor mailing list