From cc4ec81600d6159143d45523ce8ca3425e95256a Mon Sep 17 00:00:00 2001 From: fsmosca Date: Mon, 19 Apr 2021 19:33:43 +0800 Subject: [PATCH] Fix a bug in OS determination Fix issue #39 --- python_easy_chess_gui.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/python_easy_chess_gui.py b/python_easy_chess_gui.py index 7b95c13..e896380 100644 --- a/python_easy_chess_gui.py +++ b/python_easy_chess_gui.py @@ -52,6 +52,7 @@ import chess.engine import chess.polyglot import logging +import platform as sys_plat log_format = '%(asctime)s :: %(funcName)s :: line: %(lineno)d :: %(' \ @@ -61,11 +62,12 @@ APP_NAME = 'Python Easy Chess GUI' -APP_VERSION = 'v1.13' +APP_VERSION = 'v1.14' BOX_TITLE = '{} {}'.format(APP_NAME, APP_VERSION) platform = sys.platform +sys_os = sys_plat.system() ico_path = {'win32': {'pecg': 'Icon/pecg.ico', 'enemy': 'Icon/enemy.ico', @@ -442,7 +444,7 @@ def run(self): folder = folder.parents[0] try: - if platform == 'win32': + if sys_os == 'Windows': self.engine = chess.engine.SimpleEngine.popen_uci( self.engine_path_and_file, cwd=folder, creationflags=subprocess.CREATE_NO_WINDOW) @@ -850,7 +852,7 @@ def get_engine_id_name(self, path_and_file, q): folder = folder.parents[0] try: - if platform == 'win32': + if sys_os == 'Windows': engine = chess.engine.SimpleEngine.popen_uci( path_and_file, cwd=folder, creationflags=subprocess.CREATE_NO_WINDOW) @@ -1075,7 +1077,7 @@ def add_engine_to_config_file(self, engine_path_and_file, pname, que): data = json.load(json_file) try: - if platform == 'win32': + if sys_os == 'Windows': engine = chess.engine.SimpleEngine.popen_uci( engine_path_and_file, cwd=folder, creationflags=subprocess.CREATE_NO_WINDOW) @@ -1170,7 +1172,7 @@ def check_engine_config_file(self): folder = epath.parents[0] try: - if platform == 'win32': + if sys_os == 'Windows': engine = chess.engine.SimpleEngine.popen_uci( engine_path_and_file, cwd=folder, creationflags=subprocess.CREATE_NO_WINDOW)