Skip to main content

Remove tempory files at program exit, combination of tempfile and atexit should be as simple as possible.

Project description

tempfileatexit

Python library for removing temporary files and directories when program finishes.

Usage

import tempfileatexit
import tempfile

(fs, my_tempfile) = tempfile.mkstemp()
my_tempdir = tempfile.mkdtemp()

tempfileatexit.register(my_tempfile)
tempfileatexit.register(my_tempdir)


print(tempfileatexit.list(verbose=True))

After you run the code and the program exxists, the my_tempfile and my_tempdir will be gone.

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

tempfileatexit-0.0.2.linux-x86_64.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

tempfileatexit-0.0.2-py3-none-any.whl (3.1 kB view hashes)

Uploaded Python 3

Supported by

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