[Tutor] socket / over network

linuxian iandsd pylinuxian at gmail.com
Wed Apr 9 14:50:25 CEST 2008


in case it helps here is a very basic  example:

import MySQLdb, glob, os, re, shutil
from ftplib import FTP

a=file_to_fetch
ftp=FTP('ftp_server')
  ftp.login('user_name','password')
  try:
   aa=ftp.nlst(a)
   b='/home/a'
   bb=os.path.basename(aa[0])
   e=os.path.basename(b)
   c=open(b, 'wb')
   ftp.retrbinary('RETR '+aa[0], c.write)
   c.close()

well u just copied some pieces of my own code to maybe help you get started
with ftp as you maybe don't know that you have to open a file for writing &
then write into it the stream from ftp retrieve cmd.


On Mon, Apr 7, 2008 at 7:16 AM, Alan Gauld <alan.gauld at btinternet.com>
wrote:

>
> "Nathan McBride" <nomb85 at comcast.net> wrote
>
> > Going off of wha tyou said, if I choose to use ftp, is there a way i
> > could do everything from within python including the server to get
> > the
> > files?  Is there like a ftp module for python to help in the passing
> > of
> > the files between the computers?
>
> Yes, there is an ftp module in the standard library.
>
> Alan G
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080409/d2bab293/attachment.htm 


More information about the Tutor mailing list