Calling ftp commands from python

Maurice LING mauriceling at
Thu Sep 1 02:57:24 CEST 2005

Thierry Lam wrote:
> Is it possible to run an ftp command to connect to some remote computer
> on the network.
> For example, if I want to retrieve some data from
> \\remcomputer\datafiles on the network and copy it to my local
> computer, how do I do it in python on the Unix side?
> I don't want to use mount since I don't have permission.
> Thanks
> Thierry

I use ftplib in the standard libraries.

from ftplib import FTP

def grab_geneontology():
     """Function to download gene ontology file."""
     ftp = FTP('')
     ftp.retrbinary('retr gene_ontology.obo', 
open('gdata/gene_ontology', 'wb').write)

if __name__ == '__main__': grab_geneontology()


More information about the Python-list mailing list