-------
Code
------

    remotepath = "/incoming"
    
    f = FTP(host)
    f.login(username,password)
    f.cwd(remotepath)
    localfile ="C:\\test.txt"
    fd = open(localfile,'rb')
    path,filename = os.path.split(localfile)
    f.storbinary('STOR %s' % filename,fd)
    fd.close()
    f.quit()


--------
Error
--------
Traceback (most recent call last):
  File "P:\Working\Python code\temp.py", line 21, in ?
    uploadFile("C:\\test.txt")
  File "P:\Working\Python code\temp.py", line 16, in uploadFile
    f.storbinary('STOR %s' % filename,fd)
  File "C:\Python23\lib\ftplib.py", line 415, in storbinary
    conn = self.transfercmd(cmd)
  File "C:\Python23\lib\ftplib.py", line 345, in transfercmd
    return self.ntransfercmd(cmd, rest)[0]
  File "C:\Python23\lib\ftplib.py", line 327, in ntransfercmd
    resp = self.sendcmd(cmd)
  File "C:\Python23\lib\ftplib.py", line 241, in sendcmd
    return self.getresp()
  File "C:\Python23\lib\ftplib.py", line 214, in getresp
    raise error_perm, resp
ftplib.error_perm: 553 test.txt: No such file or directory.

Disclaimer

This e-mail and any attachments is confidential and intended solely for the use 
of the individual(s) to whom it is addressed. Any views or opinions presented 
are solely those of the author and do not necessarily represent those of 
Waterstone Capital Management, L.P and affiliates. If you are not the intended 
recipient, be advised that you have received this e-mail in error and that any 
use, dissemination, printing, forwarding or copying of this email is strictly 
prohibited. Please contact the sender if you have received this e-mail in 
error. You should also be aware that e-mails are susceptible to interference 
and you should not assume that the contents of this e-mail originated from the 
sender above or that they have been accurately reproduced in their original 
form. Waterstone Capital Management, L.P. and affiliates accepts no 
responsibility for information, or errors or omissions in this e-mail or use or 
misuse thereof. If in doubt, please verify the authenticity with the!
  sender.


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to