Redirect some print statments to stderr

Otherwise they errors will not show up if the console output is
redirected to a file
This commit is contained in:
Philipp Hörist 2019-02-16 10:36:27 +01:00
parent a944e7e6e1
commit 4c3110c27d
3 changed files with 8 additions and 7 deletions

View File

@ -163,7 +163,7 @@ def ngettext(s_sing, s_plural, n, replace_sing=None, replace_plural=None):
try:
locale.setlocale(locale.LC_ALL, '')
except locale.Error as error:
print(error)
print(error, file=sys.stderr)
try:
LANG = get_default_lang()
@ -172,7 +172,7 @@ try:
# find the translation
os.environ['LANG'] = LANG
except Exception as error:
print('Failed to determine default language')
print('Failed to determine default language', file=sys.stderr)
import traceback
traceback.print_exc()
@ -188,6 +188,6 @@ for dir_ in iter_locale_dirs():
else:
break
else:
print('No translations found')
print('Dirs searched: %s' % get_locale_dirs())
print('No translations found', file=sys.stderr)
print('Dirs searched: %s' % get_locale_dirs(), file=sys.stderr)
_ = _translation.gettext

View File

@ -28,7 +28,7 @@ def parseLogLevel(arg):
return int(arg)
if arg.isupper() and hasattr(logging, arg):
return getattr(logging, arg)
print(_('%s is not a valid loglevel') % repr(arg))
print(_('%s is not a valid loglevel') % repr(arg), file=sys.stderr)
return 0
def parseLogTarget(arg):
@ -69,7 +69,8 @@ def parseAndSetLogLevels(arg):
target = parseLogTarget(target.strip())
if target:
logging.getLogger(target).setLevel(level)
print("Logger %s level set to %d" % (target, level))
print("Logger %s level set to %d" % (target, level),
file=sys.stderr)
class colors:

View File

@ -80,7 +80,7 @@ class ExceptionDialog():
traceback.print_exception(type_, value, tb, None, trace)
self.text = self.get_issue_text(trace.getvalue())
buffer_.set_text(self.text)
print(self.text)
print(self.text, file=sys.stderr)
self._ui.exception_view.set_editable(False)
self._ui.exception_dialog.show()