On Aug 20, 6:41 pm, Gregory Ewing <greg.ew...@canterbury.ac.nz> wrote: > bvdp wrote: > > The whole problem I was having is that I was trying to tie a small > > application (an helper to the main application) to use a bit of the > > existing code as a pseudo-library. > > This is precisely the reason that it's a bad idea to > directly terminate the program from somewhere deep inside > the code. It makes it hard to re-use the code in another > context. > > It's much better to raise an exception containing an > appropriate error message, catch it at the top level > of the application and print the message and exit there. > Then you can easily re-use any of the code in a context > where it's not appropriate to have it exit out from > under you. > > -- > Greg
Thanks Greg. That makes a lot of sense ... for the next program I write :) -- http://mail.python.org/mailman/listinfo/python-list