Skip to main content

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.

Source Distribution

Safeout-0.3.tar.gz (2.0 kB view details)

Uploaded Source

File details

Details for the file Safeout-0.3.tar.gz.

File metadata

  • Download URL: Safeout-0.3.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.20.1 setuptools/40.4.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.6.8

File hashes

Hashes for Safeout-0.3.tar.gz
Algorithm Hash digest
SHA256 3703b522f865f81338d07c95d3ceaf7bda2fa46dfbe6da5590a467bd7b1f1fcc
MD5 b409b9a2135c90501dbf2d2d8c33c06c
BLAKE2b-256 e58a6d53feedef23966c20c79ffcd2fde8036188c21e5bdd630f26683124223f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page