View Single Post
Old 01-03-2022, 05:26 PM   #30
wiso
Enthusiast
wiso knows what time it iswiso knows what time it iswiso knows what time it iswiso knows what time it iswiso knows what time it iswiso knows what time it iswiso knows what time it iswiso knows what time it iswiso knows what time it iswiso knows what time it iswiso knows what time it is
 
wiso's Avatar
 
Posts: 33
Karma: 2114
Join Date: Nov 2021
Device: kindle
Quote:
Originally Posted by ATimson View Post
It looks like the ZIP support might be trying to get exclusive access to the files?

I keep my Calibre library in my OneDrive folder, so trying to get the duration for a newly-added files. Ones that have completed the sync to OneDrive are fine.

Other apps can read the ZIP files while the sync is still pending. I would expect the plugin to be able to read the duration without requiring exclusive access to the file...

Spoiler:

calibre, version 5.34.0
ERROR: Unhandled exception: <b>PermissionError</b>:[Errno 13] File is open in another process: 'c:\\users\\USERNAME\\onedrive\\documents\\calibre library\\unknown\\age of darkness (3078)\\age of darkness - unknown.zip'

calibre 5.34 [64bit] embedded-python: True is64bit: True
Windows-10-10.0.22000 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.22000')
Python 3.8.5
Windows: ('10', '10.0.22000', '', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 46, 0) && DeDRM (10, 0, 2) && AZW6 Image Merge (1, 0, 0) && Package KFX (from KFX Input) (1, 46, 0) && AudioBook_Duration (1, 0, 7) && Category Tags (0, 1, 3) && Count Pages (1, 11, 1) && GetFileName (0, 1, 1) && Goodreads Sync (1, 15, 1) && KFX metadata reader (from KFX Input) (1, 46, 0) && KFX Input (1, 46, 0) && KePub Metadata Reader (3, 4, 3) && KePub Metadata Writer (3, 4, 3) && KePub Output (3, 5, 3) && KindleUnpack - The Plugin (0, 83, 0)
Traceback (most recent call last):
File "calibre\utils\filenames.py", line 358, in __init__
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'c:\\users\\USERNAME\\onedrive\\documents\\calibre library\\unknown\\age of darkness (3078)\\age of darkness - unknown.zip'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "calibre_plugins.AudioBook_Duration.main", line 240, in update_duration
File "calibre\db\legacy.py", line 581, in set_metadata
File "calibre\db\cache.py", line 75, in call_func_with_lock
File "calibre\db\cache.py", line 1425, in set_metadata
File "calibre\db\cache.py", line 1420, in set_field
File "calibre\db\cache.py", line 1220, in set_field
File "calibre\db\backend.py", line 1595, in windows_check_if_files_in_use
File "calibre\utils\filenames.py", line 382, in __init__
PermissionError: [Errno 13] File is open in another process: 'c:\\users\\USERNAME\\onedrive\\documents\\calibre library\\unknown\\age of darkness (3078)\\age of darkness - unknown.zip'

I think the zip file is not the only one in use.

As seen in these lines, the error comes when trying to update the metadata in caliber (in the metadata.opf file)
Spoiler:

File "caliber_plugins.AudioBook_Duration.main", line 240, in update_duration
File "caliber \ db \ legacy.py", line 581, in set_metadata
File "caliber \ db \ cache.py", line 75, in call_func_with_lock
File "caliber \ db \ cache.py", line 1425, in set_metadata
File "caliber \ db \ cache.py", line 1420, in set_field
File "caliber \ db \ cache.py", line 1220, in set_field
File "caliber \ db \ backend.py", line 1595, in windows_check_if_files_in_use
File "caliber \ utils \ filenames.py", line 382, ​​in __init__

This line
caliber_plugins.AudioBook_Duration.main ", line 240, in update_duration

is the one that tries to write to the metadata.opt file

This line
File "caliber \ db \ legacy.py", line 581, in set_metadata

It's from the caliber library itself that tries to do the set_metadata

Reading a file in use wouldn't be a big problem, but writing to a file in use, I'm not sure how to handle it.

At the moment it is not something that I think I can change in the short term.

Last edited by wiso; 01-03-2022 at 05:32 PM.
wiso is offline   Reply With Quote