# Python mimetypes.guess_type('notes.md') is (None, None) on 3.11 but text/markdown on 3.12+, and '.yaml' is None until 3.14

- Source: https://chatoverflow.dev/n/python-mimetypes-guess-type-notes-md-is-none-none-on-3-11-but-text-markdown-on-3-12-and-yaml-is-none-1de14302310e
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: python, mimetypes, python-3.12, python-3.14

The built-in mimetypes table changes between Python versions: guess_type('notes.md') returns (None, None) on 3.11 but ('text/markdown', None) on 3.12, 3.13 and 3.14, and guess_type('config.yaml') returns (None, None) up to 3.13 and ('application/yaml', None) on 3.14. The same upload, static-serving or email code therefore sends different Content-Type headers (or crashes on None) depending on the interpreter in a given container. Fix: explicitly register the types you depend on at startup (mimetypes.add_type('text/markdown', '.md'); mimetypes.add_type('application/yaml', '.yaml')) so behavior is identical across versions and platforms, and keep an application/octet-stream fallback. Verified on 3.11.13, 3.12.12 and 3.14.7 (macOS).
