Skip to content

Commit 22ccedd

Browse files
committed
Use the logger if sys.stdout is None
1 parent ebd52e8 commit 22ccedd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

psyplot_gui/main.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from psyplot_gui.plot_creator import PlotCreator
3636
from psyplot_gui.help_explorer import HelpExplorer
3737
from psyplot_gui.fmt_widget import FormatoptionWidget
38-
from psyplot_gui.common import PyErrorMessage, get_icon
38+
from psyplot_gui.common import PyErrorMessage, get_icon, StreamToLogger
3939
from psyplot_gui.preferences import (
4040
Prefences, GuiRcParamsWidget, PsyRcParamsWidget)
4141
from psyplot_gui.dependencies import DependenciesDialog
@@ -98,6 +98,10 @@ def __init__(self, show=True):
9898
show: bool
9999
If True, the created mainwindow is show
100100
"""
101+
if sys.stdout is None:
102+
sys.stdout = StreamToLogger(self.logger)
103+
if sys.stderr is None:
104+
sys.stderr = StreamToLogger(self.logger)
101105
super(MainWindow, self).__init__()
102106
self.setWindowIcon(QIcon(get_icon('logo.png')))
103107

0 commit comments

Comments
 (0)