From 9b04049fbe01c831ede3c03e2e68a75fcc7cddc6 Mon Sep 17 00:00:00 2001 From: Mike Evans Date: Mon, 9 Oct 2023 11:27:02 +0100 Subject: [PATCH] Potential fix for issuu#20 Checks for zero length files and skips processing them. --- batdetect2/cli.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/batdetect2/cli.py b/batdetect2/cli.py index 66aada8..50408fe 100644 --- a/batdetect2/cli.py +++ b/batdetect2/cli.py @@ -119,6 +119,9 @@ def detect( error_files = [] for index, audio_file in enumerate(files): try: + if not os.path.getsize(audio_file): + click.echo(f"\n{index} {audio_file} is empty! Skipping.") + continue if not args["quiet"]: click.echo(f"\n{index} {audio_file}")