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.
Installation
pip install tempfileatexit
Usage
Automatic way
import tempfileatexit as tfae
(fs, my_tempfile) = tfae.mkstemp()
my_tempdir = tfae.mkdtemp()
print(tempfileatexit.list(verbose=True))
Manual way
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
Release history Release notifications | RSS feed
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.3.tar.gz
(2.1 kB
view details)
Built Distribution
File details
Details for the file tempfileatexit-0.0.3.tar.gz
.
File metadata
- Download URL: tempfileatexit-0.0.3.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc30db37a3a27f1cbab3469d4d286cf31a7f496039c495c1301789546a54fe32 |
|
MD5 | c8be9672e0487da58cf3d4ba322d3213 |
|
BLAKE2b-256 | 184d84c250a90c3ea9bdd293e98a8f1ece44b405efa2c25fbfe41df60480b2d7 |
Provenance
File details
Details for the file tempfileatexit-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: tempfileatexit-0.0.3-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bf1945cbfe5ced15966286b4e329276a0d6d36a868646b67c780bff7f3df74d |
|
MD5 | e7a70d4104e74688218de3c79fbb9fd3 |
|
BLAKE2b-256 | 00a79fee02ee914c13fd18635991e0ee8d524b5ce5b539d1acf448465c9511b3 |