Running Tethys causes output not to show in jupyter notebooks
Closed this issue · 1 comments
rplzzz commented
Prior to running Tethys, output goes to the notebook. The "Starting Tethys..." output also goes to the notebook, but subsequent output goes to the console, including anything you execute after Tethys has completed.
I suspect the problem is related to this item on Stack Overflow:
https://stackoverflow.com/questions/25494182/print-not-showing-in-ipython-notebook-python
rplzzz commented
This behavior is apparently caused by rebinding sys.stdout
https://github.com/JGCRI/tethys/blob/master/tethys/model.py#L36
# instantiate logger and log file
sys.stdout = Logger()
sys.stdout.log = open(self.settings.OutputFolder + "logfile.log", "w")
...
# clean up log
sys.stdout.log.close()
sys.stdout = sys.__stdout__