mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
the right way to dynamically specify a module for import
This commit is contained in:
1 parent
ccb47b4993
commit
2ac910adcf
1 file changed
+1
-1
@@ -54,7 +54,7 @@ def load_modules():
|
||||
if name.endswith(".py") and not name.startswith('.'):
|
||||
cfg.log.info("importing modules/%s" % name)
|
||||
try:
|
||||
exec("import modules.%s" % (name[:-3]))
|
||||
__import__("modules.%s" % (name[:-3]))
|
||||
except ImportError, e:
|
||||
cfg.log.error(_("Couldn't import modules/%s: %s") % (name, e))
|
||||
else:
|
||||
|
||||
Reference in new issue
Block a user