Skip to main content

dire

Python equivalent of Perl's warn/die functions.

Synopsis

from dire import *

warn("This will print to sys.stdout")
die("This will `warn` and then `sys.exit(1)`")
die("This will `warn` and then `sys.exit(2)`", exit_val=2)

Description

I miss having these two functions that in Perl. I find myself defining them in most every program I write, so I'm making this module so I can just import them.

warn(msg)

The warn function will simply print(message, file=sys.stderr).

die(msg, exit_val=1)

The die function will call warn with a message and will then call sys.exit with the exit_val parameter. NB: In Unix, an exit value of 0 indicates no error. The default value of die.exit_val is 1 simply because it is not zero. You could choose to set exit_val=0 to halt program execution without indicating an error.

Author

Ken Youens-Clark kyclark@gmail.com

Metadata

Release files for dire 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dire 0.1.3
File Size Uploaded Provenance Actions
dire-0.1.3.tar.gz 1.6 kB Without provenance Details for dire-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dire 0.1.3
File Interpreter ABI Platform Actions
dire-0.1.3-py3-none-any.whl Python 3 none any Details for dire-0.1.3-py3-none-any.whl

Total release size: 4.5 kB

Release files / dire-0.1.3.tar.gz

Download URL dire-0.1.3.tar.gz
Size 1.6 kB
Tags Source
SHA-256 checksum
How to use checksums
efb08a269d95023fea1211b51f0bd46dba2e6f35d10d0657d566656747d86457
BLAKE2b-256 checksum
How to use checksums
09a00764bedf21632d8288955e57571377b699e84dfedad9a1b01b46ef4764d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

Release files / dire-0.1.3-py3-none-any.whl

Download URL dire-0.1.3-py3-none-any.whl
Size 2.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a68a71028c6034eefa115abb8ccf5d5030146aaf059d110052d0cd21df47269
BLAKE2b-256 checksum
How to use checksums
d4866352cad6c089cb339fcc81b626ebce989ead067e7587aa9029f5bc5ed24c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

Security for dire 0.1.3

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.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page