Ed Leafe wrote:
Is there any way to use __import__ to replace the following:
exec("from %s import *" % modulename)
I shouldn't do this but:
module = __import__(modulename)
try:
for key in module.__all__:
globals()[key] = module[key]
except AttributeError:
globals().update(module.__dict__)
But really, you shouldn't be using from x import * as it
has unpredictable results as well.
http://www.python.org/doc/faq/programming.html#what-are-the-best-practices-for-using-import-in-a-module
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list