From 6eefe16c4bc90785744accd3cbb309b7f51b5cb4 Mon Sep 17 00:00:00 2001 From: grglcy Date: Fri, 10 May 2024 18:09:02 +0100 Subject: [PATCH] Don't try to read stderr when exception is thrown --- src/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.py b/src/main.py index ab665e8..8e212b3 100644 --- a/src/main.py +++ b/src/main.py @@ -45,10 +45,10 @@ def transcode_worker(in_track, out_track, encoder): additional_args = ('--bitrate', '128', '--music') subprocess_args = (str(encoder),) + additional_args + (in_track, out_track) try: - result = subprocess.run(subprocess_args, capture_output=True, text=True, check=True) - return f"Transcoded '{in_track}' successfully" + subprocess.run(subprocess_args, capture_output=True, text=True, check=True) + return f"Transcoded '{in_track}' successfully." except CalledProcessError: - return f"ERROR: Transcoding of '{in_track}' failed with errors:\n{result.stderr}" + return f"ERROR: Transcoding of '{in_track}' failed." def main(input_dir: Path, output_dir: Path, encoder: Path):