diff --git a/beets/plugins.py b/beets/plugins.py index 3a7049c10..8eb41a3ef 100644 --- a/beets/plugins.py +++ b/beets/plugins.py @@ -16,6 +16,7 @@ import logging import itertools +import traceback # Global logger. log = logging.getLogger('beets') @@ -44,13 +45,18 @@ def load_plugins(names=()): for name in itertools.chain(names, DEFAULT_PLUGINS): modname = '%s.%s' % (PLUGIN_NAMESPACE, name) try: - __import__(modname, None, None) - except ImportError, exc: - # Again, this is hacky: - if exc.args[0].endswith(modname): - log.warn('plugin %s not found' % name) - else: - raise + try: + __import__(modname, None, None) + except ImportError, exc: + # Again, this is hacky: + if exc.args[0].endswith(' ' + name): + log.warn('** plugin %s not found' % name) + else: + raise + except: + log.warn('** error loading plugin %s' % name) + log.warn(traceback.format_exc()) + _instances = {} def find_plugins(): diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index 29546c79a..e504d187f 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -339,7 +339,15 @@ def main(): """Run the main command-line interface for beets.""" # Get the default subcommands. from beets.ui.commands import default_commands - + + # Read defaults from config file. + config = ConfigParser.SafeConfigParser() + config.read(CONFIG_FILE) + + # Load requested plugins. + plugnames = config_val(config, 'beets', 'plugins', '') + plugins.load_plugins(plugnames.split()) + # Construct the root parser. commands = list(default_commands) commands += plugins.commands() @@ -354,10 +362,6 @@ def main(): # Parse the command-line! options, subcommand, suboptions, subargs = parser.parse_args() - # Read defaults from config file. - config = ConfigParser.SafeConfigParser() - config.read(CONFIG_FILE) - # Open library file. libpath = options.libpath or \ config_val(config, 'beets', 'library', DEFAULT_LIBRARY)