I am trying to produce information upon exit of a python program. I am thinking that using an atexit function would permit me to create a generalized termination procedure - if the exit is a zero condition code, then I would print out one thing, non zero then something else. Seems to me this would be accomplished with a simple conditional on the exit code, but I can't seem to find any reference on how to access the value of the exit code...? Does anyone know how to access the exit code in an atexit function? Or perhaps there is a more pythonic way to do this? Thanks very much, phil
Related questions
Related questions
- The Overflow Blog
-
-
- Featured on Meta
-
-
-
Hot Network Questions
- How do I generate +4.5 V and -4.5 V from a 9 V battery using an opamp?
- Stochastic order of generalized chi-square distributions
- Do you die sooner if you retire later?
- Is user enumeration a problem for a passwordless app?
- What is this G1000 MFD symbol?
- Where can I get another Lightscale Trident (or is it impossible to get another one)?
- I'm thinking of quitting my job after a month. How would I explain this to future employers?
- Basic questions about starting an individual PhD in Germany that I haven't found answers to
- How to delete only writable files?
- Mechanics of re-licensing a fork of permissively licensed code
- Does an equipment unattach when it becomes a creature?
- A hilarious parody of Western movies where an entire town collapses into tunnels
- How do I roleplay when given a mechanics prompt?
- Place(make visible) object over another object
- Why are they called Terafim?
- Lead rudely demands fixing alleged error on weekend
- Visiting UK with a valid visa but a soon-expiring passport
- Short story a watcher who sleeps ten thousand years and wakes to destabilize stagnant civilization if needed 1980s or earlier
- Why does the author use "you almost got us killed" vs "you almost killed us"?
- Make a hexagonal earth with geometry nodes in blender 5.0
- Incorrect (but reasonable) employment dates on CV for PhD application
- At what speed does a pulse propagate in a conducting wire?
- Why does mass appear in both the Einstein Field Equations, and the equations of motion of particles interacting via non-gravitational forces
- Rear pressure bulkhead
lang-py
atexitonly registers a function to run upon termination, which must be defined by you. The output ofatexitwill be determined by the custom function you include inatexit.