Comment 0 for bug 44773

Revision history for this message
Andrew Bennetts (spiv) wrote : Uploading a tar.gz to https://launchpad.net/products/picard/main/+pots/picard/+upload fails

OOPS-133C192

This appears to be a bug in Python's tarfile module. If a gzipped tar file is passed to TarFile.open using the fileobj argument, and the order of the keys of the tarfile.TarFile.METH_OPEN dictionary returns "bz2" before "gz", then "ValueError: no support for external file objects" is raised.

On my i386-architecture laptop, the dictionary-ordering luckily avoids this bug, but I'm guessing that for some reason it's different on Launchpad's production servers (64-bit?).

We can work around by detecting gzip files ourselves (with "content.startswith('\037\213')") and explicitly calling gzopen instead of open.