On Nov 20, 4:37 pm, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Try with StringIO/cStringIO, these modules are supposed to give you > in-memoryobjects compatible with file object interface.
I found this solution not working. I had similar problem: I wanted to write some string into the in- memory file, then transfer it via ftp to some file and forget in- memory content. from ftplib import FTP ftp = FTP('ftp.server.org') ftp.login('ID','pswd') import StringIO filename = 'some_file.txt' command = 'STOR ' + filename outfile = StringIO.StringIO() outfile.write(some_string + '\n') ftp.storlines(command, outfile) ftp.quit() outfile.close() The file shows up on the FTP server, but with ZERO length. I think the problem is that ftp.storelines attempts to use outfile's read() function, which is not present in StringIO objects (they use getvalue() instead). Quite an annoying inconsistency. Any thoughts, please? -- Marcin -- http://mail.python.org/mailman/listinfo/python-list