mimicking a file in memory

Neil Cerutti horpner at yahoo.com
Wed Dec 12 14:20:24 EST 2007


On 2007-12-12, mgierdal at gmail.com <mgierdal at gmail.com> wrote:
> I found this solution not working.
> outfile = StringIO.StringIO()
> outfile.write(some_string + '\n')

You need to rewind the file with outfile.seek(0) before
proceeding, or storlines will encounter an immediate EOF when it
attempts to read data.

> ftp.storlines(command, outfile)
 outfile.close()

-- 
Neil Cerutti
Henry VII found walking difficult because he had an abbess on his knee.
--History Exam Blooper



More information about the Python-list mailing list