0005785: print statements in Check.py causing a crash in Windows (pythonw.exe) after outputting 4096 characters. Change warning print statements to logging.

svn: r20010
This commit is contained in:
Tim G L Lyons 2012-07-16 17:53:43 +00:00
parent 4494e643cd
commit 91586b708c
6 changed files with 22 additions and 18 deletions

View File

@ -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:

View File

@ -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...
#---------------------------------------------------------------

View File

@ -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()

View File

@ -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:

View File

@ -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:

View File

@ -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.