Added the EOFError to the list of expected errors when processing files

This commit is contained in:
mbsantiago 2024-11-11 12:44:21 +00:00
parent 1a11174bc4
commit 69f59ff559

View File

@ -1,4 +1,5 @@
"""BatDetect2 command line interface.""" """BatDetect2 command line interface."""
import os import os
import click import click
@ -129,10 +130,9 @@ def detect(
): ):
results_path = audio_file.replace(audio_dir, ann_dir) results_path = audio_file.replace(audio_dir, ann_dir)
save_results_to_file(results, results_path) save_results_to_file(results, results_path)
except (RuntimeError, ValueError, LookupError) as err: except (RuntimeError, ValueError, LookupError, EOFError) as err:
error_files.append(audio_file) error_files.append(audio_file)
click.secho(f"Error processing file!: {err}", fg="red") click.secho(f"Error processing file {audio_file}: {err}", fg="red")
raise err
click.echo(f"\nResults saved to: {ann_dir}") click.echo(f"\nResults saved to: {ann_dir}")