From e1ed480bab11925bb61827d32ffbc61c776bb639 Mon Sep 17 00:00:00 2001 From: Cole Date: Wed, 9 Feb 2022 11:16:49 -0500 Subject: [PATCH] Replace pwd with cross platform getpass Replaced pwd (not supported on windows) with getpass in order to get user's username. Without this edit it crashes on windows. --- chs/ui/board.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chs/ui/board.py b/chs/ui/board.py index 87247ef..d1a472f 100644 --- a/chs/ui/board.py +++ b/chs/ui/board.py @@ -1,5 +1,5 @@ import chess -import pwd +import getpass import os from chs.client.ending import GameOver @@ -210,7 +210,7 @@ def get_meta_section(self, board, fen, rank, game_over): def get_user(self, is_computer=False): title = '{}BOT {}'.format(Colors.ORANGE, Colors.RESET) if is_computer else '' - name = 'stockfish {}'.format(self._level) if is_computer else pwd.getpwuid(os.getuid()).pw_name + name = 'stockfish {}'.format(self._level) if is_computer else getpass.getuser() return '{}● {}{}{}{}'.format(Colors.DULL_GREEN, title, Colors.LIGHT, name, Colors.RESET) def get_bar_section(self, rank):