diff --git a/pokemongo_bot/cell_workers/update_live_stats.py b/pokemongo_bot/cell_workers/update_live_stats.py index e51253edc5..ecfdeea6eb 100644 --- a/pokemongo_bot/cell_workers/update_live_stats.py +++ b/pokemongo_bot/cell_workers/update_live_stats.py @@ -148,16 +148,25 @@ def _update_title(self, title, platform): :raise: RuntimeError: When the given platform isn't supported. """ - if platform == "linux" or platform == "linux2" or platform == "cygwin": - stdout.write("\x1b]2;{}\x07".format(title)) - stdout.flush() - elif platform == "darwin": - stdout.write("\033]0;{}\007".format(title)) - stdout.flush() - elif platform == "win32": - ctypes.windll.kernel32.SetConsoleTitleA(title.encode()) - else: - raise RuntimeError("unsupported platform '{}'".format(platform)) + try: + if platform == "linux" or platform == "linux2" or platform == "cygwin": + stdout.write("\x1b]2;{}\x07".format(title)) + stdout.flush() + elif platform == "darwin": + stdout.write("\033]0;{}\007".format(title)) + stdout.flush() + elif platform == "win32": + ctypes.windll.kernel32.SetConsoleTitleA(title.encode()) + else: + raise RuntimeError("unsupported platform '{}'".format(platform)) + except AttributeError: + self.emit_event( + 'log_stats', + level = 'error', + formatted = "Unable to write window title" + ) + self.terminal_title = False + self._compute_next_update() def _get_stats_line(self, player_stats):