![]() |
#1 |
Member
![]() Posts: 23
Karma: 10
Join Date: May 2010
Device: none
|
![]()
If I already have a cover.jpg file in the directory and I go to metadata editor, download a cover and hit 'OK' I got
File "/home/kovid/build/calibre/src/calibre/utils/magick_draw.py", line 221, in save_cover_data_to IOError: [Errno 2] No such file or directory: u'..../cover.jpg' I need to go to the directory, manually remove cover.jpg file, only then, when I hit OK, new cover file is saved. I have the latest Calibre 7.1 installed under Ubuntu The line 221 in magic_draw just tries the open cover.jpg file for writing in 'wb' mode 221 with open(path, 'wb') as f: My question is if 'wb' (write in binary mode) necessary when opening file in Linux (not in Window) and if this might cause the problem ? |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,201
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I just tried it and it worked fine for me in linux (wb mode works on both linux and windows and indeed is used throughout calibre).
Is this happening with all books or just one book? |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Member
![]() Posts: 23
Karma: 10
Join Date: May 2010
Device: none
|
Happens with all the books ( Calibre directory is on NAS)
Hi Kovid !
(It was quick !) It happens with all the books. My Calibre directory is on NAS Can this be the reason ( I think SQLite/metadata is not involved , it just try to write file? |
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,201
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I dont see why being on NAS would cause a problem.
Tome me the message about Can you post the actual path that occurs in the error message instead of ..../cover.jpg |
![]() |
![]() |
![]() |
#5 |
Member
![]() Posts: 23
Karma: 10
Join Date: May 2010
Device: none
|
Here are the complete details
Traceback (most recent call last):
File "/home/kovid/build/calibre/src/calibre/gui2/dialogs/metadata_single.py", line 704, in accept File "/home/kovid/build/calibre/src/calibre/library/database2.py", line 474, in set_cover File "/home/kovid/build/calibre/src/calibre/utils/magick_draw.py", line 221, in save_cover_data_to IOError: [Errno 2] No such file or directory: u"/mm/CalibreLibrary/Pindar/The Complete Odes (Oxford World's Classics) (82)/cover.jpg" /mm is mountpoint for NAS directory cover.jpg has all the permissions for read/write I need 'cd' to directory and do 'rm cover.jpg' then it works. Also if I hit 'Reset cover to default' save it and then download covert and save - it work as well. Looks like the mere presence of cover.jpg is the problem P.S. I tried to do source install of 7.1 to try and modify 'wb' to 'w'. First it required poppler package - when I installed it , it run further but fail in one of gcc compilation Last edited by q345; 06-06-2010 at 09:39 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,201
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You dont need to do a source install, you can run calibre from source easioly by following the instructions in the user manual for setting up a development environment
|
![]() |
![]() |
![]() |
#7 |
Member
![]() Posts: 23
Karma: 10
Join Date: May 2010
Device: none
|
Run in debug mode with 'wb' changed to 'w' didn't help
Run in debug mode with 'wb' changed to 'w' didn't help
|
![]() |
![]() |
![]() |
#8 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,201
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
strange. You can work around it by simply putting in
if os.path.exists(path): os.remove(path) in that function. |
![]() |
![]() |
![]() |
#9 |
Member
![]() Posts: 23
Karma: 10
Join Date: May 2010
Device: none
|
This line works (problem is it tries to open file for writing)
Hi Kovid !
This line works. Thanks I wound out that the problem (for some reason) is that it tries to open file for writing) I inserted before line 221 ) ff = open(path, 'r') print ff ff.close() it print filename OK but ff = open(path, 'w') print ff ff.close() Cries Errno 2 - No such file. Again, I didn't check if it's the same for local directory or only for mountpoint. I don't have this problem for other metadata I can't understand why it can't open this particular file for writing. Is locking might be involved. it was mounted with mount -t cifs |
![]() |
![]() |
![]() |
#10 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,201
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Hmm I'm afraid I don't have a clue as to what the problem might be.
|
![]() |
![]() |
![]() |
#11 |
Member
![]() Posts: 23
Karma: 10
Join Date: May 2010
Device: none
|
There are 2 workarounds so it's not a big problem
One is to delete the file in magic_draw.py
and second is to reset the cover from metadata menu. I'll try to see if it happens on local harddrive too |
![]() |
![]() |
![]() |
#12 |
Enthusiast
![]() Posts: 28
Karma: 12
Join Date: Oct 2009
Location: Eastern NC, near the coast
Device: Kindle Klassic (K1), Kindle 3 wifi & 3G, and Sony Pocket
|
What if I don't want a Cover page. No cover...nada.
How to convince Calibre? |
![]() |
![]() |
![]() |
#13 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,201
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
click the trash icon under the cover image in edit metadata
|
![]() |
![]() |
![]() |
#14 |
Enthusiast
![]() Posts: 28
Karma: 12
Join Date: Oct 2009
Location: Eastern NC, near the coast
Device: Kindle Klassic (K1), Kindle 3 wifi & 3G, and Sony Pocket
|
KayakerNC What if I don't want a Cover page. No cover...nada.
How to convince Calibre? Then Calibre decides to duplicate the 1st page as a cover. I don't want to see any cover page, but I can live with it. |
![]() |
![]() |
![]() |
#15 |
Member
![]() Posts: 23
Karma: 10
Join Date: May 2010
Device: none
|
It turned out not to be a Calibre problem
Kovid !
It turned out not to be a Calibre problem, When I invoke python interpreter it can't open ANY existing file for writing if this file is located on NAS ( mounted with mount -t cifs). It can delete file, create new file and open existing file for reading, but not 'w' or 'wb' mode in open if file exists. It return error code 2, saying "No such file" |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre changes size of cover.jpg when copy to new Libary --> see PDF attached | icq70610 | Calibre | 5 | 10-02-2010 01:29 PM |
JPG cover files not removed from Novel | js4c | Calibre | 5 | 08-03-2010 09:27 PM |
Extracting a cover image from lit file | p3aul | Calibre | 6 | 07-25-2010 04:33 PM |
Two cover .mobi file | Xabache | Kindle Formats | 2 | 07-10-2010 06:25 AM |
Setting first HTML file Image as Cover? | phnord | Calibre | 2 | 01-09-2010 03:13 AM |