Closed benfoley closed 2 years ago
Just as a FYI you can pipe data with subprocess from the Python side.
Should be fixed now with #121 .
Still an issue with the ESPnet engine.
espnet/objects/model.py has p = run(f"cd {local_espnet_path}; ./run.sh --nj 1 &> {run_log_path}")
which gives the non-zero exit status 1
error when run.sh fails for whatever reason.
Would be good to catch the errors and send a message to the GUI that the process has stopped. Otherwise the GUI will spin forever.
@mattchrlw suggest using capture_output=true in subprocess.run.
Just by the way you can set the current working directory on the python side and that will make the ./run.sh
command cleaner
You could do something like this:
import os
import contextlib
from pathlib import Path
@contextlib.contextmanager
def working_directory(path):
"""Changes working directory and returns to previous on exit."""
prev_cwd = Path.cwd()
os.chdir(path)
try:
yield
finally:
os.chdir(prev_cwd)
Or if you are using subprocess you could explicitly set the cwd
parameter there. I think either of these are better than building the path used for the commands via string manipulations for a number of reasons.
after logging refactor this should no longer be an issue
Need better handling of this error. It occurs
Hard to reproduce, but the few times I have seen it the
tmp_log.txt
file ends after the aligning data line: