Package: python-pycountry
Version: 0.14.1+ds1-2
Severity: grave

--- Please enter the report below this line. ---

Pycountry has been broken by an update of iso-codes.

It appears that the file /usr/share/xml/iso-codes/iso_639.xml now contains a new attribute for some languages : "common_name" (for instance for "Bengali"/"Bangla").

When importing pycountry, the following exception is raised:

>>> import pycountry
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pycountry/__init__.py", line 104, in <module>
    languages = Languages(os.path.join(DATABASE_DIR, 'iso_639.xml'))
  File "pycountry/db.py", line 54, in __init__
    entry.attributes.get(key).value)
KeyError: u'common_name'

Please find attached to this bug report a patch fixing this issue.

--- System information. ---
Architecture: amd64
Kernel:       Linux 3.2.0-4-amd64

Debian Release: wheezy/sid
  990 testing         www.deb-multimedia.org
  990 testing         security.debian.org
  990 testing         ftp.free.fr
  500 unstable        ftp.free.fr
  500 stable          security.debian.org
  500 stable          ftp.free.fr

--- Package information. ---
Depends             (Version) | Installed
=============================-+-==============
python2.7                     | 2.7.3~rc2-2.1
 OR python2.6                 | 2.6.8-0.2
python          (>= 2.6.6-7~) | 2.7.3~rc2-1
python               (<< 2.8) | 2.7.3~rc2-1
iso-codes                     | 3.40-1
python-lxml                   | 2.3.2-1


Package's Recommends field is empty.

Package's Suggests field is empty.



diff -ru pycountry.orig/src/pycountry/__init__.py pycountry/src/pycountry/__init__.py
--- pycountry.orig/src/pycountry/__init__.py	2012-11-19 13:59:38.000000000 +0100
+++ pycountry/src/pycountry/__init__.py	2012-11-19 13:58:04.179394858 +0100
@@ -52,6 +52,7 @@
     field_map = dict(iso_639_2B_code='bibliographic',
                      iso_639_2T_code='terminology',
                      iso_639_1_code='alpha2',
+                     common_name='common_name',
                      name='name')
     data_class_name = 'Language'
     xml_tag = 'iso_639_entry'

Reply via email to