Open frankenstein91 opened 10 months ago
The type is application/vnd.openxmlformats-officedocument.wordprocessingml.document
(note the "application" at the start). Both the media type and the subtype are required.
Yes, I must have made a mistake when I copied the MIME type on my Linux system. But I still can't get any further on my Windows system. @zooba: Do you see my mistake here too? Would be very nice
Python 3.11.6 (tags/v3.11.6:8b6ee5b, Oct 2 2023, 14:57:12) [MSC v.1935 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mimetypes
>>> print(mimetypes.guess_extension("application/vnd.openxmlformats-officedocument.wordprocessingml.document"))
None
>>>
Do you have Office installed?
Windows doesn't have an exhaustive database built-in, it allows applications to register their own MIME types when they are installed.
I do not have office installed... but looks like Windows knows it
It may know a display name without having a MIME registration - those are separate things in Windows.
Your code works fine for me with Python 3.11 and Word installed, so I would assume it's simply not registered in your case. There's nothing we can do about that - send feedback to Microsoft through the Windows Feedback tool?
@zooba maybe Devs should than change https://docs.python.org/3/library/mimetypes.html from
The optional strict argument is a flag specifying whether the list of known MIME types is limited to only the official types [registered with IANA](https://www.iana.org/assignments/media-types/media-types.xhtml). When strict is True (the default), only the IANA types are supported; when strict is False, some additional non-standard but commonly used MIME types are also recognized.
To something like Only file types known to the operating system are recognized.
I personally find it very confusing otherwise
You're more than welcome to create a pull request with the updates. You'll find the Docs/library/mimetypes.rst
in this repository.
Unfortunately English is not my mother tongue, I would suggest someone from the USA or the UK can formulate this much better than I can. @patrickmccallum: sorry for linking you here... but do you have an idea how your database could be become a part of Python?
Bug report
Bug description:
I currently have a problem with guessing file extensions from the MIME type, unfortunately. I understood that only files with a registry at IANA can be guessed and checked the linked page. As I understand, my affected data is registered with IANA.
The IANA link: https://www.iana.org/assignments/media-types/application/vnd.openxmlformats-officedocument.wordprocessingml.document
I hoped to see
.docx
as a return valueCPython versions tested on:
3.11
Operating systems tested on:
Linux, Windows