(SP)TEMPDIR
Function parameters:
sptempdir.TemporaryDirectory(suffix="", prefix="", dir=None, delete=True)
By default temporary directory will be deleted when function it is closed.
Example 1:
The name property returns the name of a temporary directory.
import os
from sptempdir import TemporaryDirectory
with TemporaryDirectory(prefix="prefbegin_", suffix="_suffend") as temp:
print('temp.name:', temp.name) # retrieve the name temporary directory
print('Inside:', os.path.exists(temp.name))
print('Outside:', os.path.exists(temp.name))
Terminal output:
$ temporary_directory.py temp.name: /tmp/prefbegin_66XxiFkN6Nm4_suffend Inside: True Outside: False
Example 2:
import os
from sptempdir import TemporaryDirectory
temp = TemporaryDirectory()
print('temp.name:', temp.name) # retrieve the name temporary directory
print('Tempdir exists:', os.path.exists(temp.name))
temp.remove() # manually remove temporary directory
print('Tempdir exists:', os.path.exists(temp.name))
Terminal output:
$ temporary_directory.py temp.name: /tmp/RCgAzfsATQnb Tempdir exists: True Tempdir exists: False
Example 3:
If the delete parameter is delete=False, the temp directory is not deleted.
import os
from sptempdir import TemporaryDirectory
temp = TemporaryDirectory(delete=False)
print('temp.name:', temp.name) # retrieve the name temporary directory
print('Tempdir exists:', os.path.exists(temp.name))
temp.remove() # manually remove temporary directory
print('Tempdir exists:', os.path.exists(temp.name))
Terminal output:
$ temporary_directory.py temp.name: /tmp/kWwCWn42NRsr Tempdir exists: True Tempdir exists: False
Example 4:
Specific dir where you want to create temporary directory.
from sptempdir import TemporaryDirectory
temp = TemporaryDirectory(dir="/home/user/Desktop")
print(temp.name) # retrieve the name temporary directory
Terminal output:
$ temporary_directory.py /home/user/Desktop/4ZdTvLNqVuyE
Installation:
pip install sptempdir
License:
BSD
(SP)TEMPDIR = ( Simple Python ) TEMPDIR
Metadata
Release files for sptempdir 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sptempdir-0.1.5.tar.gz | 3.3 kB | Without provenance | Details for sptempdir-0.1.5.tar.gz |
Release files / sptempdir-0.1.5.tar.gz
| Download URL | sptempdir-0.1.5.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b6f466f90feba30f8eab8f659fee8702072d775436bcbc917fab94783cb68add
|
|
BLAKE2b-256 checksum How to use checksums |
7e9da2fbd2d0b5b0a05b91a83d55c535e72c44fdfc2cfff575ba7b40f7f8abf9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for sptempdir 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.