On Mon, Mar 29, 2010 at 10:36:48AM -0300, Lucas Meneghel Rodrigues wrote:
> 2010/3/29 Jean Parpaillon <[email protected]>:
...
> > Hi,
> > On my system (Python 2.5.4) and amongst official documentation,
> > mimetypes use file name and extensions to get the mimetypes, and not
> > libmagic.
>
> Ok, sorry, my fault, I confused the standard library mimetypes with
> another 3rd party python package, that does use libmagic *and* the
> mime database.
>
> > And for tar.bz2 file, output is: ("application/x-tar", None)
>
> Strange... On my python 2.6.2 system I get:
>
> In [3]: mimetypes.guess_type("foo.tar.bz2")
> Out[3]: ('application/x-tar', 'bzip2')
FYI.
Debian 5
Python 2.5.2 (r252:60911, Jan 4 2009, 21:59:32)
[GCC 4.3.2] on linux2
>>> import mimetypes
>>> mimetypes.guess_type("./a.tar.bz2")
(None, None)
--
Python 2.6.4rc2 (r264rc2:75497, Oct 20 2009, 02:55:11)
[GCC 4.4.1] on linux2
got the right result as Lucas
> I did expect it to behave exactly the same in older python versions,
> but turns out I was wrong.
>
> > Where is the trick ?
>
> Let's drop my suggestion of using mimetypes. I just looked into the
> libmagic wrapper and it looks like it could be improved and considered
> for autotest inclusion. Let me spend some time on it, will send a
> patch soon.
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest