Skip to content

Make write atomic #180

@ctoth

Description

@ctoth

Currently if you call write, it directly calls write on the underlying file object.
If then the power fails or the process crashes the file is left in a garbage state.
I recommend writing to a temporary file, then using rename as this is the accepted practice for atomic writes.

Alternatively you could depend on https://github.com/untitaker/python-atomicwrites

Let me know which approach you prefer and I will open a PR implementing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions