Commit c0178db7 authored by Philipp Hörist's avatar Philipp Hörist
Browse files

Redirect some print statments to stderr

Otherwise they errors will not show up if the console output is
redirected to a file
parent c5d2f8bd
......@@ -151,7 +151,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()
......@@ -161,7 +161,7 @@ def ngettext(s_sing, s_plural, n, replace_sing=None, replace_plural=None):
os.environ['LANG'] = LANG
print('Found default language: %s' % 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()
......@@ -177,6 +177,6 @@ def ngettext(s_sing, s_plural, n, replace_sing=None, replace_plural=None):
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
......@@ -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:
......
......@@ -85,7 +85,7 @@ def __init__(self, type_, value, tb):
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.exception_view.set_editable(False)
self.dialog.show()
if __name__ == '__main__':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment