hi all...
i want to upload a file using ftp
path1 = "D:\Python\test"
host = sys.argv[1]
def main():
try:
f = ftplib.FTP(host)
except (socket.error ,socket.gaierror),e:
logging.info("Error: cannot reach '%s',%s" % (host,e))
return
logging.info("***connected to host '%s'***" % host)
try:
f.login(user="root",passwd="aims")
except ftplib.error_perm:
logging.info("Error :cannot login ")
f.quit()
return
logging.info("***logged in ***")
try:
f.storbinary('STOR %s' % path1,open(path1,'rb'))
except ftplib.error_perm:
logging.info("Error:cannot upload a file '%s'" % path1)
os.unlink(path1)
else:
logging.info("***uploaded successfully***" % path1)
f.quit()
return
if __name__ == "__main__":
main()
when i run the script in a cmd i'm getting error like
IOError:Error[13] permission denied :"D:\Python\test"