tarfile.open(mode='w:gz'|'w|gz'|..., fileobj=StringIO()) fails.

sebastian.noack at googlemail.com sebastian.noack at googlemail.com
Tue May 27 01:43:53 EDT 2008

On May 27, 2:17 am, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
> It's not a bug, you must extract the StringIO contents *after* closing
> tar_file, else you won't get the last blocks pending to be written.

I looked at tarfile's source code last night after I wrote this
message and figured it out. But the problem is that TarFile's close
method closes the underlying file object after the last block is
written and when you close StringIO you can not get its content
anymore. Wtf does it close the underlying file? There is absolute no
reason for doing this. Are you still sure this isn't a bug?

Sebastian Noack

More information about the Python-list mailing list