Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #65665

Re: Possible bug with stability of mimetypes.guess_* function output

Newsgroups comp.lang.python
Date 2014-02-08 02:59 -0800
References (2 earlier) <mailman.6497.1391802017.18130.python-list@python.org> <c26b109c-0247-4c99-80c3-dccfa3d7ab06@googlegroups.com> <mailman.6517.1391845924.18130.python-list@python.org> <e5cc422f-e324-4ad3-9f24-cf8c462ddf15@googlegroups.com> <mailman.6526.1391848759.18130.python-list@python.org>
Message-ID <3ca96b6c-ff2d-4fe2-8492-e0a8ff961ede@googlegroups.com> (permalink)
Subject Re: Possible bug with stability of mimetypes.guess_* function output
From Asaf Las <roegltd@gmail.com>

Show all headers | View raw


On Saturday, February 8, 2014 10:39:06 AM UTC+2, Peter Otten wrote:
> Asaf Las wrote:
> > On Saturday, February 8, 2014 9:51:48 AM UTC+2, Peter Otten wrote:
> >> At least the mimetypes already defined in the module could easily produce
> >> the same guessed extension consistently.
> > imho one workaround for OP could be to supply own map file in init() thus
> > ensure unambiguous mapping across every platform and distribution. guess
> > some libraries already doing that. or write wrapper and process
> > all_guesses to eliminate ambiguity up to needed requirement.
> > that is in case if bug request will be rejected.
> 
> You also have to set mimetypes.types_map and mimetypes.common_types to an 
> empty dict (or an OrderedDict).

Hmmm, yes. then the quickest workaround is to get all guesses list then
sort it and use the one at index 0.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Possible bug with stability of mimetypes.guess_* function output Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-02-07 19:06 +0100
  Re: Possible bug with stability of mimetypes.guess_* function output Asaf Las <roegltd@gmail.com> - 2014-02-07 11:09 -0800
    Re: Possible bug with stability of mimetypes.guess_* function output Asaf Las <roegltd@gmail.com> - 2014-02-07 11:17 -0800
      Re: Possible bug with stability of mimetypes.guess_* function output Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-07 19:28 +0000
    Re: Possible bug with stability of mimetypes.guess_* function output Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-02-07 20:39 +0100
    Re: Possible bug with stability of mimetypes.guess_* function output Peter Otten <__peter__@web.de> - 2014-02-07 20:40 +0100
      Re: Possible bug with stability of mimetypes.guess_* function output Asaf Las <roegltd@gmail.com> - 2014-02-07 12:25 -0800
        Re: Possible bug with stability of mimetypes.guess_* function output Peter Otten <__peter__@web.de> - 2014-02-08 08:51 +0100
          Re: Possible bug with stability of mimetypes.guess_* function output Asaf Las <roegltd@gmail.com> - 2014-02-08 00:24 -0800
            Re: Possible bug with stability of mimetypes.guess_* function output Peter Otten <__peter__@web.de> - 2014-02-08 09:39 +0100
              Re: Possible bug with stability of mimetypes.guess_* function output Asaf Las <roegltd@gmail.com> - 2014-02-08 02:59 -0800

csiph-web