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