Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Write out a file safely (atomically)

Project description

# Safeout: write out a file safely

With `safeout`, you can write:

from safeout import safeout
with safeout('output.txt') as output:
output.write("Hello world\n")

and this will write out the file `output.txt` in a safe, atomic manner. That
is, if there are any problems (Exceptions or a crash) in the `with` block, then
there there will be **no output**. If the `with` block completes, then the
output file will include the whole result.

So, if the output file exists, you can be confident that the process completed
correctly.

License: MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Safeout, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size Safeout-0.2.1.tar.gz (1.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page