I just tried to convert a (hugh size) ftp.retrbinary run into a pseudo-file object with .read(bytes) method in order to not consume 500MB on a copy operation.
First I thought, its easy as usual with python using something like 'yield' or so. Yet I didn't manage to do (without using threads or rewriting 'retrbinary')? Any ideas? #### I tried a pattern like: .... def open(self,ftppath,mode='rb'): class FTPFile: #TODO ... def iter_retr() ... def callback(blk): how-to-yield-from-here-to-iter_retr blk??? ftp.retrbinary("RETR %s" % relpath,callback) def read(self, bytes=-1): ... self.buf+=self.iter.next() ... .... -- http://mail.python.org/mailman/listinfo/python-list