diff --git a/src/calibre/library/cli.py b/src/calibre/library/cli.py index 0a392c1b8c..ea9f8a3f1e 100644 --- a/src/calibre/library/cli.py +++ b/src/calibre/library/cli.py @@ -386,7 +386,7 @@ def command_remove(args, dbpath): else: ids.append(int(y[0])) - do_remove(get_db(dbpath, opts), ids) + do_remove(get_db(dbpath, opts), set(ids)) return 0 diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index cdf1894ab6..79737f4f57 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -921,9 +921,12 @@ class LibraryDatabase2(LibraryDatabase): ''' Removes book from the result cache and the underlying database. ''' - path = os.path.join(self.library_path, self.path(id, index_is_id=True)) + try: + path = os.path.join(self.library_path, self.path(id, index_is_id=True)) + except: + path = None self.data.remove(id) - if os.path.exists(path): + if path and os.path.exists(path): try: winshell.delete_file(path, no_confirm=True, silent=True) except: