Skip to content

Commit

Permalink
More details when an exception occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
jordimas committed Oct 10, 2024
1 parent aa34f3e commit 71256bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/whisper_ctranslate2/whisper_ctranslate2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import sys
import datetime
from .commandline import CommandLine
import traceback


def get_diarization(audio, diarize_model, verbose):
Expand Down Expand Up @@ -255,8 +256,12 @@ def main():
writer(result, audio_path, writer_args)

except Exception as e:
error_details = traceback.format_exc()
sys.stderr.write(
f"Error: unable to process file: {audio_path} with exception '{e}'\n"
f"Error: Unable to process file: {audio_path}\n"
f"Exception Type: {type(e).__name__}\n"
f"Exception Message: {e}\n"
f"Traceback:\n{error_details}\n"
)
continue

Expand Down

1 comment on commit 71256bd

@ChrisProkop
Copy link

@ChrisProkop ChrisProkop commented on 71256bd Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Windows in an Anaconda command window, errors do not display any messages, it will just quietly do nothing and return to the cmd prompt. I have to use alternatives like insanely-fast-whisper in order to get errors that will help me figure out what I need to fix with my installation, but whisper-ctranslate2 will fail without noting anything.

Please sign in to comment.