vicky schrieb: > 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 :( You maybe want to use a context manager. Look for 'with statement' and 'contextlib' in your docs. HTH, Mick.