diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 773c10cae..0022fac74 100644 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1232,7 +1232,10 @@ def show_stats(lib, query, exact): for item in items: if exact: - total_size += os.path.getsize(item.path) + try: + total_size += os.path.getsize(item.path) + except OSError as exc: + log.info('could not get size of {}: {}', item.path, exc) else: total_size += int(item.length * item.bitrate / 8) total_time += item.length diff --git a/docs/changelog.rst b/docs/changelog.rst index 56810ef6c..808010aae 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -45,6 +45,8 @@ Fixes: * :doc:`/plugins/lyrics`: The Genius backend has been re-enabled. * :doc:`/plugins/edit`: Editing metadata now moves files, when appropriate (like the :ref:`modify-cmd` command). :bug:`1804` +* The :ref:`stats-cmd` command no longer crashes when files are missing or + inaccessible. :bug:`1806` .. _beets.io: http://beets.io/ .. _Beetbox: https://github.com/beetbox