Skip to content

Commit cc47056

Browse files
committed
Update python_easy_chess_gui.py
* Remove parameter creationflags=subprocess.CREATE_NO_WINDOW in chess.engine.SimpleEngine.popen_uci as the engine console no longer pops up when executed. This also solves one issue when pecg is run in linux. Under this test python-chess v0.29.0 is used. * Remove unused subprocess module.
1 parent d51615e commit cc47056

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

python_easy_chess_gui.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import PySimpleGUI as sg
3939
import os
4040
import sys
41-
import subprocess
4241
import threading
4342
from pathlib import Path, PurePath # Python 3.4 and up
4443
import queue
@@ -61,7 +60,7 @@
6160

6261

6362
APP_NAME = 'Python Easy Chess GUI'
64-
APP_VERSION = 'v1.4'
63+
APP_VERSION = 'v1.5'
6564
BOX_TITLE = '{} {}'.format(APP_NAME, APP_VERSION)
6665

6766

@@ -432,8 +431,7 @@ def run(self):
432431

433432
try:
434433
self.engine = chess.engine.SimpleEngine.popen_uci(
435-
self.engine_path_and_file, cwd=folder,
436-
creationflags=subprocess.CREATE_NO_WINDOW)
434+
self.engine_path_and_file, cwd=folder)
437435
except chess.engine.EngineTerminatedError:
438436
logging.warning('Failed to start {}.'.format(self.engine_path_and_file))
439437
self.eng_queue.put('bestmove {}'.format(self.bm))
@@ -835,8 +833,7 @@ def get_engine_id_name(self, path_and_file, q):
835833

836834
try:
837835
engine = chess.engine.SimpleEngine.popen_uci(
838-
path_and_file, cwd=folder,
839-
creationflags=subprocess.CREATE_NO_WINDOW)
836+
path_and_file, cwd=folder)
840837
id_name = engine.id['name']
841838
engine.quit()
842839
except Exception:
@@ -1054,8 +1051,7 @@ def add_engine_to_config_file(self, engine_path_and_file, pname, que):
10541051

10551052
try:
10561053
engine = chess.engine.SimpleEngine.popen_uci(
1057-
engine_path_and_file, cwd=folder,
1058-
creationflags=subprocess.CREATE_NO_WINDOW)
1054+
engine_path_and_file, cwd=folder)
10591055
except Exception:
10601056
logging.exception('Failed to add {} in config file.'.format(pname))
10611057
que.put('Failure')
@@ -1145,8 +1141,7 @@ def check_engine_config_file(self):
11451141

11461142
try:
11471143
engine = chess.engine.SimpleEngine.popen_uci(
1148-
engine_path_and_file, cwd=folder,
1149-
creationflags=subprocess.CREATE_NO_WINDOW)
1144+
engine_path_and_file, cwd=folder)
11501145
except Exception:
11511146
logging.exception('Failed to start engine.')
11521147
continue

0 commit comments

Comments
 (0)