fix to state, i18ize some errors
This commit is contained in:
1 parent
af3a8e8c07
commit
f1a6c62b37
14 files changed
+177
-60
No files matched your search
+8
-15
@@ -61,21 +61,18 @@ class KataGoEngine:
|
||||
|
||||
exepath, exename = os.path.split(exe)
|
||||
if exepath and not os.path.isfile(exe):
|
||||
self.katrain.log(f"KataGo binary {exe} does not exist, check general settings.", OUTPUT_ERROR)
|
||||
self.katrain.log(i18n._('Kata exe not found').format(exe=exe), OUTPUT_ERROR)
|
||||
return # don't start
|
||||
elif not exepath and not any(
|
||||
os.path.isfile(os.path.join(path, exe)) for path in os.environ.get("PATH", "").split(os.pathsep)
|
||||
):
|
||||
self.katrain.log(
|
||||
f"KataGo binary `{exe}` not found in PATH, check your environment variables or add the full path in general settings.",
|
||||
OUTPUT_ERROR,
|
||||
)
|
||||
self.katrain.log(i18n._('Kata exe not found in path').format(exe), OUTPUT_ERROR )
|
||||
return # don't start
|
||||
elif not os.path.isfile(model):
|
||||
self.katrain.log(f"Model {model} does not exist, check general settings.", OUTPUT_ERROR)
|
||||
self.katrain.log(i18n._('Kata model not found').format(model), OUTPUT_ERROR)
|
||||
return # don't start
|
||||
elif not os.path.isfile(cfg):
|
||||
self.katrain.log(f"KataGo config file {cfg} does not exist, check general settings.", OUTPUT_ERROR)
|
||||
self.katrain.log(i18n._('Kata config not found').format(config=cfg), OUTPUT_ERROR)
|
||||
return # don't start
|
||||
self.command = f'"{exe}" analysis -model "{model}" -config "{cfg}" -analysis-threads {config["threads"]}'
|
||||
self.start()
|
||||
@@ -88,14 +85,10 @@ class KataGoEngine:
|
||||
self.command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True
|
||||
)
|
||||
except (FileNotFoundError, PermissionError, OSError) as e:
|
||||
if not self.config["katago"].strip():
|
||||
self.katrain.log(
|
||||
i18n._("Starting default Kata failed").format(command=self.command, error=e), OUTPUT_ERROR,
|
||||
)
|
||||
else:
|
||||
self.katrain.log(
|
||||
i18n._("Starting Kata failed").format(command=self.command, error=e), OUTPUT_ERROR,
|
||||
)
|
||||
self.katrain.log(
|
||||
i18n._("Starting Kata failed").format(command=self.command, error=e), OUTPUT_ERROR,
|
||||
)
|
||||
return # don't start
|
||||
self.analysis_thread = threading.Thread(target=self._analysis_read_thread, daemon=True).start()
|
||||
self.stderr_thread = threading.Thread(target=self._read_stderr_thread, daemon=True).start()
|
||||
|
||||
|
||||
Reference in new issue
Block a user