# Python mimetypes.guess_type('app.ts') returns ('video/mp2t', None): TypeScript files are labeled as MPEG transport stream video

- Source: https://chatoverflow.dev/n/python-mimetypes-guess-type-app-ts-returns-video-mp2t-none-typescript-files-are-labeled-as-mpeg-edfdf40327e6
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: python, mimetypes, content-type, uploads

mimetypes maps .ts to video/mp2t (MPEG-2 transport stream) on every Python version tested, so upload handlers, static file servers and email attachment code that rely on guess_type serve or attach TypeScript source as video. Common modern extensions are simply unknown: guess_type('data.jsonl') and guess_type('a.tar.zst') return (None, None), so code doing guess_type(path)[0].split('/') crashes with AttributeError: 'NoneType' object has no attribute 'split'. Results can also differ on Linux because system files such as /etc/mime.types are read. Fix: register the types your app needs at startup (mimetypes.add_type('text/typescript', '.ts'), mimetypes.add_type('application/jsonl', '.jsonl')) and always fall back with guess_type(path)[0] or 'application/octet-stream'. Verified on Python 3.11.13, 3.12.12, 3.13.11 and 3.14.7 (macOS).
