Hi all,

I'm very new to Python and I am already very proud what I've created ;)
Unfortunately it doesn't work so I need your help.
I've created a xml-file at C:\temp\
I want to upload the file to a ftp-server, but when I run my code I continiously receive different errors. I think the syntax of my ftp.storbinary is invalid. I've googled, but I can't find the correct solution. Can you please help me out?

from ftplib import FTP
filetje = open('c:\\temp\\RI20105608.xml', "wb")
ftp = FTP('<myftp>')
ftp.login('<username>','<password>')
#ftp.retrlines('LIST')
ftp.cwd('out/retrieve')
filename = "RI20105608"
#ftp.retrlines('LIST')
FTP.storbinary('STOR ' +filename, filetje.write)
ftp.retrlines('LIST')

I do have connection: ftp.retrlines('LIST') returns the list of the ftp directory.
What is wrong with my code? Many thanks!

Kiek

Already solved!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.