[ adding Orestis to CC, who submitted the patch in file's #511 ] On Tue, Jun 28, 2016 at 11:42:35AM +0200, Christoph Biedl wrote: > > since python3-magic 1:5.28-1 the file type detection is broken. > > Instead of returning a string whih contains the magic, it returns > > double encoded bytes: > (...) > > b"b'gzip compressed data, max compression, from Unix'" > > Thanks for catching, and also for the patch. However, this reverts a > change upstream introduced in > https://github.com/file/file/commit/5560418ebc6f94e80953c8646383fdb70758fc7a > to "Restore python-2 compatibility" as reported in > http://bugs.gw.com/view.php?id=511 > > Still, even after applying your patch a test script works when > using python2.7, and now I'm confused. Since my python knowledge is > rather limited, could you please check for both versions, too - and > perhaps shed some light on it?
Hm, for me it also still works in Python 2. But only because it doesn't reach the str(r, 'utf-8') (it chooses the other branch). Python 2 does indeed not have a 2-argument str. I'm currently not sure in which cases this path is reached with Python 2. Perhaps Orestis remembers why the patch was needed, and perhaps has an idea for restoring Python 3 support.
signature.asc
Description: Digital signature