Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:bug': 0.07; 'ambiguity': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'wrapper': 0.09; 'bug': 0.12; 'dict': 0.16; 'mimetypes': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'rejected.': 0.16; 'subject:skip:m 10': 0.16; 'unambiguous': 0.16; 'wrote:': 0.18; 'module': 0.19; 'header:User-Agent:1': 0.23; 'requirement.': 0.24; '(or': 0.24; 'extension': 0.26; 'least': 0.26; 'defined': 0.27; 'header:X-Complaints-To:1': 0.27; 'thus': 0.29; 'that.': 0.31; 'libraries': 0.31; 'workaround': 0.31; 'file': 0.32; 'guess': 0.33; 'could': 0.34; 'subject:with': 0.35; 'doing': 0.36; 'las': 0.37; 'easily': 0.37; 'mapping': 0.38; 'needed': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'ensure': 0.60; 'map': 0.64; 'guessed': 0.84; 'otten': 0.84; 'subject:Possible': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: Possible bug with stability of mimetypes.guess_* function output Date: Sat, 08 Feb 2014 09:39:06 +0100 Organization: None References: <03a2c4c8-313f-4382-8be9-5163d8bf644c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p57bd9cc2.dip0.t-ipconnect.de User-Agent: KNode/4.7.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391848759 news.xs4all.nl 2941 [2001:888:2000:d::a6]:39781 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65650 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).