2

i'm trying to Copy my file from c:\test to my FTP folder ; This is my code :

import ftplib
import socket
Name = socket.gethostname()
filename = Name +".csv"
ftp = ftplib.FTP('xxxxxxxxxxxxxxxxxx')
ftp.login('xxxxxx','xxxxxxxx')
ftp.cwd('test')
filematch = "C:\\test\\" + Name + ".csv"
filetocopy = open(filematch,'r')
ftp.storlines('STOR' +filename , filetocopy)

but i'm running into an Error :

    raise error_perm, resp
ftplib.error_perm: 500 ?
Cœur
  • 37,241
  • 25
  • 195
  • 267
Mehdi ouahabi
  • 67
  • 1
  • 2
  • 11

1 Answers1

3

Solved:

import ftplib
import socket
Name = socket.gethostname()
filename = Name +".csv"
ftp = ftplib.FTP('xxxxxxxxxxxxxxxxxx')
ftp.login('xxxxxx','xxxxxxxx')
ftp.cwd('test')
filematch = "C:\\test\\" + Name + ".csv"
filetocopy = open(filematch,'r')
ftp.storlines('STOR ' + filename, filetocopy)
Mawg says reinstate Monica
  • 38,334
  • 103
  • 306
  • 551
Mehdi ouahabi
  • 67
  • 1
  • 2
  • 11