From 4697de789cc3fc86bccb4bc85ee2c39022e7eefc Mon Sep 17 00:00:00 2001 From: Tim G L Lyons Date: Fri, 1 Mar 2013 13:12:20 +0000 Subject: [PATCH] 0003428: When running with pythonw.exe, Windows may crash if you write to stdout. Some more print statements changed to log.warning. svn: r21510 --- src/DateHandler/__init__.py | 10 ++++++++-- src/gen/plug/menu/_enumeratedlist.py | 11 +++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/DateHandler/__init__.py b/src/DateHandler/__init__.py index 3caf415fd..8df838f20 100644 --- a/src/DateHandler/__init__.py +++ b/src/DateHandler/__init__.py @@ -23,6 +23,12 @@ """ Class handling language-specific selection for date parser and displayer. """ +#------------------------------------------------------------------------- +# +# set up logging +# +#------------------------------------------------------------------------- +import logging # import prerequisites for localized handlers from _DateHandler import (LANG, LANG_SHORT, LANG_TO_PARSER, LANG_TO_DISPLAY, @@ -57,7 +63,7 @@ try: else: parser = LANG_TO_PARSER[LANG_SHORT]() except: - print "Date parser for", LANG, "not available, using default" + logging.warning(_("Date parser for '%s' not available, using default") % LANG) parser = LANG_TO_PARSER["C"]() # Initialize global displayer @@ -73,7 +79,7 @@ try: else: displayer = LANG_TO_DISPLAY[LANG_SHORT](val) except: - print "Date displayer for", LANG, "not available, using default" + logging.warning(_("Date displayer for '%s' not available, using default") % LANG) displayer = LANG_TO_DISPLAY["C"](val) diff --git a/src/gen/plug/menu/_enumeratedlist.py b/src/gen/plug/menu/_enumeratedlist.py index 6d44cba5a..10f045f75 100644 --- a/src/gen/plug/menu/_enumeratedlist.py +++ b/src/gen/plug/menu/_enumeratedlist.py @@ -31,6 +31,13 @@ Option class representing an enumerated list of possible values. #------------------------------------------------------------------------- from gen.plug.menu import Option +#------------------------------------------------------------------------- +# +# set up logging +# +#------------------------------------------------------------------------- +import logging + #------------------------------------------------------------------------- # # EnumeratedListOption class @@ -113,5 +120,5 @@ class EnumeratedListOption(Option): if value in (v for v, d in self.__items): Option.set_value(self, value) else: - print "Value '%s' not found for option '%s'" % (str(value), - self.get_label()) + logging.warning(_("Value '%(val)s' not found for option '%(opt)s'") % + {'val' : str(value), 'opt' : self.get_label()})