Python's
open()
method
has several modes.
But not one that is for read-only while creating the file if it does not exist.
You can work around with this append mode.
The design decision makes sense, because why would you want to read a file that doesn't exist? Nine times out of ten that is a coding error. In this side project, I had the one.