Trash Bin not working

Bug #2017217 reported by Nguyen Quoc Khanh
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Fix Released
Undecided
Unassigned

Bug Description

I have just tested the new Trash Bin (Calibre 6.16).

Right-clicking on the TrashBin icon and selecting the "Restore recently deleted..." results in an error:

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\...\\.caltrash\\b\\8349\\metadata.opf'

I guess since this is Windows, the double back-slash (\\) is the reason.

I manually browse to the .caltrash\b folder, the file is there.

Is there any "empty trash bin" option too?

description: updated
Revision history for this message
Kovid Goyal (kovid) wrote :

Works for me. the doubel back slash is simply how backslashes are
encoded in python. Post the full error message and the full path to the
library.

Changed in calibre:
status: New → Invalid
status: Invalid → Incomplete
Revision history for this message
Nguyen Quoc Khanh (quockhanh77) wrote :

calibre, version 6.16.0
ERROR: Unhandled exception: <b>FileNotFoundError</b>:[Errno 2] No such file or directory: 'C:\\Users\\Mike\\OneDrive - angels2285\\Calibre\\.caltrash\\b\\8349\\metadata.opf'

calibre 6.16 embedded-python: True
Windows-10-10.0.19045-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19045')
Python 3.10.1
Windows: ('10', '10.0.19045', 'SP0', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: Count Pages (1, 13, 0) && EpubMerge (2, 15, 0) && Goodreads (1, 7, 7) && Goodreads Sync (1, 16, 3) && Resize Cover (1, 2, 0)
Traceback (most recent call last):
  File "calibre\gui2\actions\delete.py", line 417, in undelete_recent
  File "calibre\gui2\trash.py", line 116, in __init__
  File "calibre\gui2\widgets2.py", line 225, in __init__
  File "calibre\gui2\trash.py", line 124, in setup_ui
  File "calibre\db\cache.py", line 77, in call_func_with_lock
  File "calibre\db\cache.py", line 2671, in list_trash_entries
  File "calibre\db\backend.py", line 2091, in list_trash_entries
  File "calibre\ebooks\metadata\opf2.py", line 635, in __init__
  File "calibre\ebooks\metadata\utils.py", line 36, in parse_opf
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Mike\\OneDrive - angels2285\\Calibre\\.caltrash\\b\\8349\\metadata.opf'

Revision history for this message
Kovid Goyal (kovid) wrote :

And you are saying the file

C:\Users\Mike\OneDrive - angels2285\Calibre\.caltrash\b\8349\metadata.opf

exists? If so that error makes no sense. Does it happen if you try with
a library not in OneDrive?

Revision history for this message
Nguyen Quoc Khanh (quockhanh77) wrote :

Ah, the metadata.opf file is NOT there. The 8349 folder includes only the epub and the cover.jpg.

I have to run now, if testing with another library is needed, I will do it later.

Revision history for this message
Nguyen Quoc Khanh (quockhanh77) wrote (last edit ):

Dear Kovid,

I understand why now. If the metadata.opf file doesn't exist before the book is deleted, then that error will happen. Location of the library is not relevant.

Revision history for this message
Kovid Goyal (kovid) wrote :

No the metadata.opf file is created when deleting so it should never not
exist. However, looking at the code there is a case where that creation
can fail, which I will fix.

Revision history for this message
Kovid Goyal (kovid) wrote :

Fixed in branch master. The fix will be in the next release. calibre is usually released every alternate Friday.

Changed in calibre:
status: Incomplete → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.