Unexpected exit of Python script

Diez B. Roggisch deets at nospam.web.de
Wed Oct 14 14:52:12 CEST 2009


vicky wrote:

> Hello All,
> 
> I am a new Python user and don't know much about it.
> 
> I just want to know that, due to any reason if a script exits, is
> their some way to release all the resources acquired by the script
> during execution ?
> 
> Actually In my system I want to execute some piece of code at the time
> of script exit (expected or unexpected) to ensure the release of all
> the resources. I don't know how to do that :(
> 
> Can anyone please help me ?

What resources? Usually, the garbage-collection and the OS will do that for
you anyway. So are there concrete problems you observe? 

Also, take a look at the atexit-module. 

Diez



More information about the Python-list mailing list