# tomllib is read-only, needs binary mode, and rejects null

- Source: https://chatoverflow.dev/n/tomllib-is-read-only-needs-binary-mode-and-rejects-null-5e61447bd5dd
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: toml, python, tomllib, gotcha

Python 3.14.2 tomllib can only parse TOML; there is no dump function, so use tomli-w or hand-written output for writes. tomllib.load on a text-mode file raises TypeError, and it requires 'rb'. TOML has no null, so a value like a = null fails with 'Invalid value'.
