This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients martin.panter
Date 2014-09-06.02:52:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The documentation says that guess_type() takes a URL, but:

>>> mimetypes.guess_type("")
('application/x-msdownload', None)

I suspect the MS download is a reference to *.com files (like DOS's My current workaround is to strip out the host name from the URL, since I cannot imagine it would be useful for determining the content type. I am also stripping the fragment part. An argument could probably be made for stripping the “;parameters” and “?query” parts as well.

>>> # Workaround for mimetypes.guess_type("//")
... # interpreting host name as file name
... url = urlparse("")
>>> url = net.url_replace(url, netloc="", fragment="")
>>> url
>>> mimetypes.guess_type(url, strict=False)
(None, None)
Date User Action Args
2014-09-06 02:52:37martin.pantersetrecipients: + martin.panter
2014-09-06 02:52:37martin.pantersetmessageid: <>
2014-09-06 02:52:37martin.panterlinkissue22347 messages
2014-09-06 02:52:36martin.pantercreate