FS#28065 - [calibre] crashes with "NameError: name 'ngettext' is not defined"

Attached to Project: Community Packages
Opened by Archan Paul (archan.paul) - Monday, 23 January 2012, 10:39 GMT
Last edited by Giovanni Scafora (giovanni) - Tuesday, 24 January 2012, 12:42 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Giovanni Scafora (giovanni)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
When I am trying to run "calibre 0.8.36-1", it is crashing with "NameError: name 'ngettext' is not defined" error.

Additional info:
* package version(s) calibre 0.8.36-1
* config and/or log files etc.

[arp@arpc ~]$ date
Mon Jan 23 16:06:29 IST 2012
[arp@arpc ~]$ calibre
Traceback (most recent call last):
File "/usr/bin/calibre", line 18, in <module>
from calibre.gui2.main import main
File "/usr/lib/calibre/calibre/gui2/main.py", line 18, in <module>
from calibre.library.database2 import LibraryDatabase2
File "/usr/lib/calibre/calibre/library/database2.py", line 19, in <module>
from calibre.ebooks.metadata.opf2 import metadata_to_opf
File "/usr/lib/calibre/calibre/ebooks/metadata/opf2.py", line 20, in <module>
from calibre.ebooks.metadata.book.base import Metadata
File "/usr/lib/calibre/calibre/ebooks/metadata/book/base.py", line 17, in <module>
from calibre.library.field_metadata import FieldMetadata
File "/usr/lib/calibre/calibre/library/field_metadata.py", line 44, in <module>
class FieldMetadata(dict):
File "/usr/lib/calibre/calibre/library/field_metadata.py", line 140, in FieldMetadata
'name':ngettext('Series', 'Series', 2),
NameError: name 'ngettext' is not defined


Steps to reproduce:
Run calibre
This task depends upon

Closed by  Giovanni Scafora (giovanni)
Tuesday, 24 January 2012, 12:42 GMT
Reason for closing:  Not a bug
Comment by Archan Paul (archan.paul) - Tuesday, 24 January 2012, 06:13 GMT
Following patch solves the problem.

[root@arpo lib]# diff -Naur calibre.orig/ calibre
diff -Naur calibre.orig/calibre/gui2/library/models.py calibre/calibre/gui2/library/models.py
--- calibre.orig/calibre/gui2/library/models.py 2012-01-20 15:07:19.000000000 +0530
+++ calibre/calibre/gui2/library/models.py 2012-01-24 11:41:27.438700899 +0530
@@ -7,6 +7,7 @@

import functools, re, os, traceback, errno
from collections import defaultdict
+from gettext import ngettext

from PyQt4.Qt import (QAbstractTableModel, Qt, pyqtSignal, QIcon, QImage,
QModelIndex, QVariant, QDateTime, QColor)
diff -Naur calibre.orig/calibre/library/field_metadata.py calibre/calibre/library/field_metadata.py
--- calibre.orig/calibre/library/field_metadata.py 2012-01-20 15:07:19.000000000 +0530
+++ calibre/calibre/library/field_metadata.py 2012-01-24 11:41:17.262089365 +0530
@@ -5,6 +5,7 @@
'''
import copy, traceback
from collections import OrderedDict
+from gettext import ngettext

from calibre.utils.config import tweaks

Comment by Archan Paul (archan.paul) - Tuesday, 24 January 2012, 06:16 GMT
Another discussion thread, worth reading : http://www.mobileread.com/forums/showthread.php?t=166465
Comment by Jelle van der Waa (jelly) - Tuesday, 24 January 2012, 09:45 GMT
Report the patch upstream ;)
Comment by Archan Paul (archan.paul) - Tuesday, 24 January 2012, 12:35 GMT Comment by Giovanni Scafora (giovanni) - Tuesday, 24 January 2012, 12:36 GMT
BTW, I cannot reproduce that issue.
calibre is working fine on my systems
Comment by Archan Paul (archan.paul) - Tuesday, 24 January 2012, 12:37 GMT
As suggested by the upstream maintainer, following solves the problem.
LANG=en_US.UTF-8 calibre
Comment by Giovanni Scafora (giovanni) - Tuesday, 24 January 2012, 12:38 GMT
echo $LANG
what do it returns?
Comment by Archan Paul (archan.paul) - Tuesday, 24 January 2012, 12:39 GMT
I have updated /etc/rc.conf with following and now calibre works without problem.
LOCALE=en_US.UTF-8
Comment by Giovanni Scafora (giovanni) - Tuesday, 24 January 2012, 12:40 GMT
Maybe you have to set your LANG in /etc/rc.conf or elsewhere if you are using systemd.
Comment by Giovanni Scafora (giovanni) - Tuesday, 24 January 2012, 12:41 GMT
OK, then I can close this bugreport.

Loading...