diff --git a/src/ImgManip.py b/src/ImgManip.py index 0852bc184..f5fb624ed 100644 --- a/src/ImgManip.py +++ b/src/ImgManip.py @@ -105,9 +105,9 @@ def image_dpi(source): try: import PIL.Image except ImportError: - import sys - print >> sys.stderr, _("WARNING: PIL module not loaded. " - "Image cropping in report files will not be available.") + import logging + logging.warning(_("WARNING: PIL module not loaded. " + "Image cropping in report files will not be available.")) dpi = None else: diff --git a/src/config.py b/src/config.py index a16b67690..3c2564cac 100644 --- a/src/config.py +++ b/src/config.py @@ -35,6 +35,7 @@ This package implements access to GRAMPS configuration. #--------------------------------------------------------------- import os, sys from gen.ggettext import gettext as _ +import logging #--------------------------------------------------------------- # @@ -330,10 +331,10 @@ if not os.path.exists(CONFIGMAN.filename): # If not, let's read old if there: if os.path.exists(os.path.join(const.HOME_DIR, "keys.ini")): # read it in old style: - print >> sys.stderr, "Importing old key file 'keys.ini'..." + logging.warning("Importing old key file 'keys.ini'...") CONFIGMAN.load(os.path.join(const.HOME_DIR, "keys.ini"), oldstyle=True) - print >> sys.stderr, "Done importing old key file 'keys.ini'" + logging.warning("Done importing old key file 'keys.ini'") # other version upgrades here... #--------------------------------------------------------------- diff --git a/src/gen/db/write.py b/src/gen/db/write.py index bf1d1c8a6..515627f69 100644 --- a/src/gen/db/write.py +++ b/src/gen/db/write.py @@ -986,7 +986,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): # to loop through each of the primary object tables. for cursor_func, class_func in primary_table: - print "Rebuilding %s reference map" % class_func.__name__ + logging.info("Rebuilding %s reference map" % + class_func.__name__) with cursor_func() as cursor: for found_handle, val in cursor: obj = class_func() diff --git a/src/gen/utils/configmanager.py b/src/gen/utils/configmanager.py index 427604e61..7ea82e905 100644 --- a/src/gen/utils/configmanager.py +++ b/src/gen/utils/configmanager.py @@ -37,6 +37,7 @@ import time import ConfigParser import errno import copy +import logging def safe_eval(exp): # restrict eval to empty environment @@ -274,13 +275,13 @@ class ConfigManager(object): if vtype == bool: value = raw_value in ["1", "True"] elif vtype == list: - print >> sys.stderr, "WARNING: ignoring old key '%s'" % key + logging.warning("WARNING: ignoring old key '%s'" % key) continue # there were no lists in oldstyle else: value = vtype(raw_value) else: # else, ignore it - print >> sys.stderr, "WARNING: ignoring old key '%s'" % key + logging.warning("WARNING: ignoring old key '%s'" % key) continue # with next setting ####################### End upgrade code else: @@ -294,7 +295,7 @@ class ConfigManager(object): elif type(value) == type(self.default[name][setting]): self.data[name][setting] = value else: - print >> sys.stderr, ("WARNING: ignoring key with wrong type " + logging.warning("WARNING: ignoring key with wrong type " "'%s.%s'" % (name, setting)) else: # this could be a third-party setting; add it: diff --git a/src/plugins/gramplet/bottombar.gpr.py b/src/plugins/gramplet/bottombar.gpr.py index 30df72f07..4f4ee2486 100644 --- a/src/plugins/gramplet/bottombar.gpr.py +++ b/src/plugins/gramplet/bottombar.gpr.py @@ -86,9 +86,9 @@ try: import pyexiv2 available = True except: - import sys - print >> sys.stderr, _("WARNING: pyexiv2 module not loaded. " - "Image metadata functionality will not be available.") + import logging + logging.warning(_("WARNING: pyexiv2 module not loaded. " + "Image metadata functionality will not be available.")) available = False if available: diff --git a/src/plugins/view/geography.gpr.py b/src/plugins/view/geography.gpr.py index 0412a930d..bd12b2aef 100644 --- a/src/plugins/view/geography.gpr.py +++ b/src/plugins/view/geography.gpr.py @@ -32,14 +32,15 @@ try : OSMGPSMAP = True if osmgpsmap.__version__ < '0.7.0': OSMGPSMAP = False - import sys - print >> sys.stderr, _("WARNING: osmgpsmap module not loaded. " - "osmgpsmap must be >= 0.7.0. yours is %s") % osmgpsmap.__version__ + import logging + logging.warning( _("WARNING: osmgpsmap module not loaded. " + "osmgpsmap must be >= 0.7.0. yours is %s") % + osmgpsmap.__version__) except: OSMGPSMAP = False - import sys - print >> sys.stderr, _("WARNING: osmgpsmap module not loaded. " - "Geography functionality will not be available.") + import logging + logging.warning(_("WARNING: osmgpsmap module not loaded. " + "Geography functionality will not be available.")) if OSMGPSMAP: # Load the view only if osmgpsmap library is present.