> now if i do this > > outfile = cStringIO.StringIO() > outfile.write(pyfromzip) > z=cPickle.load(outfile)
Do you have to rewind the outfile so that the read is properly positioned? The following interaction: ############################# >>> import StringIO >>> out = StringIO.StringIO() >>> out.write("hello world") >>> out.read() '' ############################# shows that if we immediately read what you write, we get nothing: the file position is not at the beginning. But as soon as we do a seek(): ############################## >>> out.seek(0) >>> out.read() 'hello world' ############################## then we're good. Alternatively, can you do this instead? ######################################### >>> out = StringIO.StringIO("hello, this is a test") >>> out.read() 'hello, this is a test' ######################################### In your case, construct the StringIO object with the content of pyfromzip, up front, rather than with a separate call to write(). _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor