FTP upload files Python

后端 未结 4 1860
星月不相逢
星月不相逢 2021-01-31 21:11

I am trying to upload file from windows server to a unix server (basically trying to do FTP). I have used the code below

#!/usr/bin/python
import ftplib
import          


        
4条回答
  •  春和景丽
    2021-01-31 22:12

    try making the file an object, so you can close it at the end of the operaton.

    myfile = open(filename, 'w')
    ftp.storbinary('RETR %s' % filename, myfile.write)
    

    and at the end of the transfer

     myfile.close()
    

    this might not solve the problem, but it may help.

提交回复
热议问题