Like atexit but for ctrl+c
Tested against Windows 10 / Python 3.10 / Anaconda
pip install ctrlchandler
# atexit
import atexit
def printx(bu=12, ba=3223):
print(bu, ba)
print('ciao')
atexit.register(printx, bu='nice', ba='ba')
exit()
nice ba
ciao
Process finished with exit code 0
from ctrlchandler import set_console_ctrl_handler
def printx(bu=12, ba=3223):
print(bu, ba)
print('ciao')
set_console_ctrl_handler(returncode=1, func=printx, bu=12011, ba=32231111)
while True:
pass
After pressing ctrl+c
^C12011 32231111
ciao
Process finished with exit code 1
Metadata
Release files for ctrlchandler 0.10
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 |
|---|---|---|---|---|
| ctrlchandler-0.10.tar.gz | 4.0 kB | Without provenance | Details for ctrlchandler-0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ctrlchandler-0.10-py3-none-any.whl | Python 3 | none | any | Details for ctrlchandler-0.10-py3-none-any.whl |
Total release size: 9.2 kB
Release files / ctrlchandler-0.10.tar.gz
| Download URL | ctrlchandler-0.10.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88d7c72c0e941f272d15047e6daffa838e84d8c8599e3b79962c1bb13cc1a227
|
|
BLAKE2b-256 checksum How to use checksums |
cb5b06bc9f4a6d0e37e153b2fcfe732937fa3622aea17b76874f896a0f01b6d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Release files / ctrlchandler-0.10-py3-none-any.whl
| Download URL | ctrlchandler-0.10-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e8409908a9322764fdf2a5ec54a1e165e913090f3bff20032598611bd07ddd45
|
|
BLAKE2b-256 checksum How to use checksums |
d3789e816d71ee461b8fca559de785e3af6c5c6e56af9af89a7d066069706fd0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Security for ctrlchandler 0.10
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.