diff --git a/beets/importer.py b/beets/importer.py index f58481bd8..548df9572 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -29,6 +29,7 @@ from beets import util from beets.util import pipeline from beets.util import syspath, normpath, displayable_path from beets.util.enumeration import enum +from beets.mediafile import UnreadableFileError action = enum( 'SKIP', 'ASIS', 'TRACKS', 'MANUAL', 'APPLY', 'MANUAL_ID', @@ -485,7 +486,13 @@ def read_tasks(config): for toppath in config.paths: # Check whether the path is to a file. if config.singletons and not os.path.isdir(syspath(toppath)): - item = library.Item.from_path(toppath) + try: + item = library.Item.from_path(toppath) + except UnreadableFileError: + log.warn(u'unreadable file: {0}'.format( + util.displayable_path(toppath) + )) + continue yield ImportTask.item_task(item) continue diff --git a/docs/changelog.rst b/docs/changelog.rst index 2a3f3a660..b5cbe913e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -80,6 +80,7 @@ Changelog names in their path. * Fix a crash when Unicode queries were used with ``import -L`` re-imports. * Fix an error when fingerprinting files with Unicode filenames on Windows. +* Warn instead of crashing when importing a specific file in singleton mode. * Add human-readable error messages when writing files' tags fails or when a directory can't be created. * Changed plugin loading so that modules can be imported without