Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to download a csv file from a FTP server ?

on 4/6/16, 6:52 AM 478 views

Hi, I wanna download a csv file from a FTP server but when I try with the line below, I have FileName.csv in my /home/openerp but the file is empty.

i = FileName.csv

pathdst = /home/openerp/

ftp.retrbinary('RETR ' + i, open(pathdst + os.sep + i, 'wb').write)

I think the problem comes from the fact it's a csv file because I used this line before with a txt file and it worked.

In advance, thanks.

On 4/6/16, 12:05 PM

There should be no difference between csv and txt files. I'm using this code to handle all files extensions without any problems. Make sure the path in your ftp server is correct if so make sure you are closing the ftp connection and the file after using them :

file = open(pathdst + os.sep + i, 'wb')
ftp.retrbinary('RETR ' + i, file.write)

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 4/6/16, 6:52 AM
Seen: 478 times
Last updated: 4/7/16, 2:33 AM