Ubuntu: Import EPUB, Metadata Error

Bug #1360693 reported by Armin Geller
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
calibre
Fix Released
Undecided
Unassigned

Bug Description

Different behavior importing an epub file between Windows and Linux (Ubuntu 14.2) calibre 2.0.

On Windows, there is no error-warning. file and metadata (author and title) are correct in calibe. On Ubuntu there is a warning. Calibre has import without metadata.
Warning message:
db030-473.epub
Traceback (most recent call last):
  File "site-packages/calibre/gui2/add.py", line 200, in add
  File "site-packages/calibre/ebooks/metadata/opf2.py", line 565, in __init__
IOError: [Errno 2] Datei oder Verzeichnis nicht gefunden: u'/tmp/calibre_2.0.0_tmp_qLA3yQ/RPWLdm_rm_worker/0.opf'

The epub is generated by Digitale Bibliothek. I will attach the file below. I see some warnings if I check the book with the editor but I wonder, why the behavior is different.

Best Regards,
Armin

Tags: epub-import
Revision history for this message
Armin Geller (armingeller) wrote :
Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1360693

Works for me on linux. Adding that wpub file gives no error and the
metadata is set correctly.

That error indicates something deleted a temporary file calibre was
using while calibre was running. Try running in debug mode as

calibre-debug -g

we may get more information that way.

 status invalid

Changed in calibre:
status: New → Invalid
Revision history for this message
Armin Geller (armingeller) wrote :

Ok. Here is the log:

armin@ubuntu:~$ calibre-debug -g
calibre 2.0 isfrozen: True is64bit: True
Linux-3.13.0-34-generic-x86_64-with-debian-jessie-sid Linux ('64bit', 'ELF')
('Linux', '3.13.0-34-generic', '#60-Ubuntu SMP Wed Aug 13 15:45:27 UTC 2014')
Python 2.7.8
Linux: ('debian', 'jessie/sid', '')
Successfully initialized third party plugins: DeDRM && Goodreads && Generate Cover && Open With && Quality Check && Find Duplicates && Manage Sony x50 Reader Book List && Favourites Menu && Goodreads Sync && KindleUnpack - The Plugin && Modify ePub
Starting up...
Traceback (most recent call last):
  File "site-packages/calibre/gui2/ui.py", line 163, in __init__
  File "site-packages/calibre/gui2/ui.py", line 177, in init_iaction
  File "site-packages/calibre/customize/__init__.py", line 582, in load_actual_plugin
  File "importlib/__init__.py", line 37, in import_module
  File "site-packages/calibre/customize/zipplugin.py", line 179, in load_module
  File "calibre_plugins.ManageSonyX50BookList.action", line 162, in <module>
ImportError: No module named PyQt4.Qt
libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
C:\Users\Armin\Desktop\Calibre-Import is not a valid directory to watch for new ebooks, ignoring
Started up in 2.86 seconds with 3 books

Debugging DND event
x-special/gnome-icon-list 62 'file:///home/armin/Schreibtisch/db030-473.epub\r-21:-27:48:48\r\n'

text/uri-list 48 'file:///home/armin/Schreibtisch/db030-473.epub\r\n'

text/plain 48 'file:///home/armin/Schreibtisch/db030-473.epub\r\n'

COMPOUND_TEXT 48 'file:///home/armin/Schreibtisch/db030-473.epub\r\n'

text/plain;charset=utf-8 48 'file:///home/armin/Schreibtisch/db030-473.epub\r\n'

Firefox rurl: None None
URLS: ['file:///home/armin/Schreibtisch/db030-473.epub']
Paths: [u'/home/armin/Schreibtisch/db030-473.epub']
Extensions: frozenset([u'epub'])
Worker Launch took: 0.401809930801
Job: 1 Read metadata (0 of 1) finished
Read metadata (0 of 1)
 libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

Read metadata (0 of 1)
libpng warning: iCCP: Not recognizing known sRGB profile that has been edited

Added Unbekannt to db in: 0.109871864319 seconds

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

Did it fail when you generated that log?

Revision history for this message
Armin Geller (armingeller) wrote :

Yes it did (same error message

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

Try running

ebook-meta db030-473.epub

does it read the metadata successfully?

Revision history for this message
Armin Geller (armingeller) wrote :

Sorry for the late answer. I got a crash error and it took some time to find it.

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

That EPUB file has no cover, so calibre is trying to render the first
page as the cover, which involves Qt WebKit and something on your system
is causing Qt WebKit to crash, you will have to try to get a backtrace
using gdb for more information. Unfortunately, in my experince Qt 5 and
gdb just dont work well together, still you can try:

echo 'run\nbt' | gdb --args /usr/bin/python2.7 /usr/bin/ebook-meta db030-473.epub --get-cover x.jpg

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

Sorry, make that

echo 'run\nbt' | gdb --args /opt/calibre/ebook-meta db030-473.epub --get-cover x.jpg

Revision history for this message
Armin Geller (armingeller) wrote :

I became the output below.

I did an additional test, follow your advice, and add a cover. I did it with the editor and add simply the pic inside the epub as cover and save that file. Then I import the updated epub. This way it works. It seems that with Linux the procedure seems to be different (I have in our German forum a person with the same problem).

armin@ubuntu:~/Schreibtisch$ echo run\nbt | gdb --args /opt/calibre/ebook-meta db030-473.epub --get-cover cover.jpg
GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /opt/calibre/ebook-meta...(no debugging symbols found)...done.
(gdb) Undefined command: "runnbt". Try "help".
(gdb) quit
armin@ubuntu:~/Schreibtisch$ echo 'run\nbt' | gdb --args /opt/calibre/ebook-meta db030-473.epub --get-cover x.jpg
GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /opt/calibre/ebook-meta...(no debugging symbols found)...done.
(gdb) Starting program: /opt/calibre/ebook-meta \nbt
process 5652 is executing new program: /opt/calibre/bin/ebook-meta
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Traceback (most recent call last):
  File "site.py", line 51, in main
  File "site-packages/calibre/ebooks/metadata/cli.py", line 168, in main
IOError: [Errno 2] Datei oder Verzeichnis nicht gefunden: u'nbt'
[Inferior 1 (process 5652) exited with code 01]
(gdb) quit
armin@ubuntu:~/Schreibtisch$

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

What shell are you using? It looks like gdb is passing nbt as an argument to ebook-convert. Try it like this

gdb --args /opt/calibre/ebook-meta db030-473.epub --get-cover x.jpg

Then at the gdb prompt type

run

and hit enter

then after the process crashes, type

bt

and hit enter to get the backtrace.

Revision history for this message
Armin Geller (armingeller) wrote :

My fault. Thanks for explaination. I am using the normal terminal. Here is the new report:

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

Ah, now we are getting somewhere. The next step is to improve the
backtrace by using binaries that do not have their symbols removed.

I have uploaded such builds of calibre here:
http://download.calibre-ebook.com/betas/

Install it by downloading the appropriate tarball (32bit or 64bit) and
running:

sudo rm -rf /opt/calibre/* && sudo tar xvf /path/to/downloaded/calibre-tarball.txz -C /opt/calibre

This assumes your calibre is installed in /opt/calibre

Then generate the backtrace as before, this time it should contain more
useful information.

Revision history for this message
Armin Geller (armingeller) wrote :

This time I have no error. See attached file. I made an additional check and import the original file into the library. It works fine.
Therefore, it seems to be something with the normal installation as running from source seems to work.

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

That's my fault, I was making a possible workaround for this issue that would prevent the crash. But I would like to properly fix it, for that I need the full backtrace. Do this:

DISPLAY= gdb --args /opt/calibre/ebook-meta db030-473.epub --get-cover x.jpg

that should still crash

Revision history for this message
Armin Geller (armingeller) wrote :

Yes this test still crash.

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

thanks, that tells me what I needed to know, the fix will be in the next
release.

Revision history for this message
Armin Geller (armingeller) wrote :

Your welcome. Thanks for all, I learned today a bit too. :)

tags: added: epub-import
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 Friday.

 status fixreleased

Changed in calibre:
status: Invalid → Fix Released
Revision history for this message
Armin Geller (armingeller) wrote :

Only a feedback: working perfect with Calibre 2.1
Thanks a lot,
Armin

Revision history for this message
Edward Donovan (edward.donovan) wrote :

Yes, thanks! You guys fixed it before I had gotten near to investigating these crashes.

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.