Python equivalent of Perl's warn and die functions
Project description
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dire-0.1.3.tar.gz.
File metadata
- Download URL: dire-0.1.3.tar.gz
- Upload date:
- Size: 1.6 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efb08a269d95023fea1211b51f0bd46dba2e6f35d10d0657d566656747d86457
|
|
| MD5 |
84e3d6e3b31281bd54acf3fb38b5cfab
|
|
| BLAKE2b-256 |
09a00764bedf21632d8288955e57571377b699e84dfedad9a1b01b46ef4764d7
|
File details
Details for the file dire-0.1.3-py3-none-any.whl.
File metadata
- Download URL: dire-0.1.3-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a68a71028c6034eefa115abb8ccf5d5030146aaf059d110052d0cd21df47269
|
|
| MD5 |
62f267df58691d7ae97a78d2c5356de8
|
|
| BLAKE2b-256 |
d4866352cad6c089cb339fcc81b626ebce989ead067e7587aa9029f5bc5ed24c
|