On 09/07/12 02:10, Chris Hare wrote:
Here is what I want to do: I have a bunch of modules to import. instead of duplicating
> a lot of code for each import, I want to do something like this: ...lots of code stripped.... Why not the more usual: import sys, os, imp, stat, \ re, webbrowser, Image, \ StringIO, shutil, datetime And let the Python ImportError alert you to what failed? Or if you must print your own errors just use try: import ... except ImportError: # your code here I'm not sure what code you think you need to duplicate or why. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor