Fencer wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">Scott
David Daniels wrote:
To be a trifle more explicit, turn:
...
if __name__ == '__main__':
main()
into:
...
if __name__ == '__main__':
try:
main()
except Exception, why:
print 'Failed:', why
import sys, traceback
traceback.print_tb(sys.exc_info()[2])
raw_input('Leaving: ')
Note that building your script like this also allows you to
open the interpretter, and type:
import mymodule
mymodule.main()
in order to examine how it runs.
Thanks alot, this was exactly what I was looking for!
--Scott David Daniels
scott.dani...@acm.org
</div>
Notice also that you'd then move all the imports inside main(), rather
than putting them at outer scope. Now some imports, such as sys and os,
may want to be at outer scope, but if they don't work,. your system is
seriously busted.
--
http://mail.python.org/mailman/listinfo/python-list