From 4b7a9ccc7f6fc175a170e7ed848d8ed3627cd7ee Mon Sep 17 00:00:00 2001 From: Vito Zanotelli Date: Fri, 19 Apr 2024 23:01:15 +0200 Subject: [PATCH] Prevents printing attempt for binary logs Previously a binary log file would cause `show_logs` to crash the whole snakemake workflow execution with a `UnicodeDecodeError`. Closes #2826 --- snakemake/logging.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/snakemake/logging.py b/snakemake/logging.py index 801929a66..ac891348f 100644 --- a/snakemake/logging.py +++ b/snakemake/logging.py @@ -506,6 +506,9 @@ def show_logs(logs): except FileNotFoundError: yield f"Logfile {f} not found." return + except UnicodeDecodeError: + yield f"Logfile {f} is not a text file." + return lines = content.splitlines() logfile_header = f"Logfile {f}:" if not lines: