Error in Compressing images losslessly

Bug #1877066 reported by Sven Dewald
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Fix Released
Undecided
Unassigned

Bug Description

Hello

after executing the "Edit book: Compress images losslessly" option I get the following error:

Failed to process 43 - Title - 06 - Seite 044.jpg with error:
Traceback (most recent call last): File "site-packages\calibre\ebooks\oeb\polish\images.py", line 34, in run File "site-packages\calibre\ebooks\oeb\polish\images.py", line 55, in compress File "site-packages\calibre\ebooks\oeb\polish\container.py", line 1054, in get_file_path_for_processing WindowsError: [Error 32] Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird: u'C:\Users\Sven\AppData\Local\calibre-cache\ee\tmp3unidp\a\00002-zwuzqk\43 - Title - 06 - Seite 044.jpg'

Failed to process 24 - Title - 06 - Seite 025.jpg with error:
Traceback (most recent call last): File "site-packages\calibre\ebooks\oeb\polish\images.py", line 34, in run File "site-packages\calibre\ebooks\oeb\polish\images.py", line 55, in compress File "site-packages\calibre\ebooks\oeb\polish\container.py", line 1054, in get_file_path_for_processing WindowsError: [Error 32] Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird: u'C:\Users\Sven\AppData\Local\calibre-cache\ee\tmp3unidp\a\00002-zwuzqk\24 - Title - 06 - Seite 025.jpg'

Failed to process 4 - Title - 06 - Seite 005.jpg with error:
Traceback (most recent call last): File "site-packages\calibre\ebooks\oeb\polish\images.py", line 34, in run File "site-packages\calibre\ebooks\oeb\polish\images.py", line 55, in compress File "site-packages\calibre\ebooks\oeb\polish\container.py", line 1054, in get_file_path_for_processing WindowsError: [Error 32] Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird: u'C:\Users\Sven\AppData\Local\calibre-cache\ee\tmp3unidp\a\00002-zwuzqk\4 - Title - 06 - Seite 005.jpg'

Different sides are always affected. Never the same.

Calibre-Version: 4.15
Operating-System: Win7

Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1877066

Those errors indicate the files in question are being opened in some
other program. Most likely an antivirus or filesync program. Make sure
the calibre cache directory that you can read the path of in those
errors is excluded from such programs and you should be fine.

 status invalid

Kovid Goyal (kovid)
Changed in calibre:
status: New → Invalid
Revision history for this message
Sven Dewald (oj-info) wrote :

I deactivated my Antivir and monitored the process with "Process Monitor v3.53". There is no other process that accesses the file.

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

And yet that error literally means that some other process has opened the
file so windows is refusing to let calibre do it.

Revision history for this message
Sven Dewald (oj-info) wrote :

In the list there are many (approx. 50) file accesses by calibre. Why doesn't calibre lock the file to other processes immediately after it is created?

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

Why would it? It is not the job of every application to lock every file
it creates to defend against interfering software. Indeed, given that
locking a file means opening it, and there are limited number of open
files a single process is allowed, doing so would be impossible.

Revision history for this message
Sven Dewald (oj-info) wrote :

The file is locked the first time it is accessed and unlocked after all file operations have ended. I do not see a problem there.

But I think I found the bug. I compared the output of "Process Monitor".
For a file where everything works, the *.jpg file is opened, read and the *.jpgxxx written. After the status "END OF FILE" both files are closed and a CreateFile for the file *.jpg follows.
However, there is no CloseFile in the log for a file with errors.
So this seems to be the own process that is blocking the file.

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

Then I need a set of steps to reproduce it, because I cant make it
happen.

Revision history for this message
Sven Dewald (oj-info) wrote :

Edit Book -> Tools -> Compress images losslessly
Check Enable lossy compression of JPEG images
Compression quality: 60
OK

Should I take screenshots of the Process Monitor?

I can also send you the eBook. It's a comic. File size approximately 200MB.
Can I upload it somewhere?

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

That does not reproduce it for me, if it is happening with some
particular book then attach it to this bug report.

Revision history for this message
Sven Dewald (oj-info) wrote :

I have the problem with several books. But not with some books either.
Here is the book that produced the above error.

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

OK I will have a look at it when I have a moment.

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

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

 status fixreleased

Changed in calibre:
status: Invalid → Fix Released
Revision history for this message
Sven Dewald (oj-info) wrote :

Perfect, it works. Thank you!

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.