new pip wrote: > Actually I want to do some clean up (or operation) before the program > actually exits. Is there any way to do that?
Ah, that's easier. :-) It might help (if this answer isn't sufficient) to post a snippet of code showing a very small example that we could talk about. You might have a "special" situation, something unusual you aren't telling us about yet. (Also, mentioning your platform and versions is always a good idea, but maybe not relevant in this case.) There are a few options: 1. "import atexit" and use that standard library module's features. 2. put a "try/finally" block around the bulk of your code, with cleanup code in the "finally" clause 3. Just stick the cleanup code at the end of your module... (this one is too obvious, so if neither of the above answers work for you, and this one is insufficient, please post example code so we know where you are...) -Peter -- http://mail.python.org/mailman/listinfo/python-list