Package: python-pycountry
Version: 0.12.1+ds1-1
Severity: minor
Tags: upstream patch

When importing, the following warning is produced:

    No handlers could be found for logger "pycountry.db"

Attached is a patch which fixes this according to
http://docs.python.org/library/logging.html#configuring-logging-for-a-library



-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.35-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-pycountry depends on:
ii  iso-codes                     3.21-1     ISO language, territory, currency,
ii  python                        2.6.6-3    interactive high-level object-orie
ii  python-support                1.0.10     automated rebuilding support for P

python-pycountry recommends no packages.

python-pycountry suggests no packages.

-- no debconf information
diff -Naur pycountry-0.12.1+ds1.old/src/pycountry/db.py pycountry-0.12.1+ds1.new/src/pycountry/db.py
--- pycountry-0.12.1+ds1.old/src/pycountry/db.py	2010-04-21 07:44:11.000000000 +0200
+++ pycountry-0.12.1+ds1.new/src/pycountry/db.py	2010-10-07 00:05:09.784425001 +0200
@@ -7,7 +7,17 @@
 import logging
 import lxml.etree
 
+# NullHandler is only defined for python >= 2.7
+if 'NullHandler' not in dir(logging):
+    class NullHandler(logging.Handler):
+        def emit(self, record):
+            pass
+    logging.NullHandler = NullHandler
+
 logger = logging.getLogger('pycountry.db')
+# Prevent warning, see
+# http://docs.python.org/library/logging.html#configuring-logging-for-a-library
+logger.addHandler(logging.NullHandler())
 
 
 class Data(object):

Attachment: pgpRgEVC1l2dz.pgp
Description: PGP signature

Reply via email to