From 620fd542a8c5ea7db6cefec440448da5d04c0148 Mon Sep 17 00:00:00 2001 From: Erick Martins Ratamero Date: Tue, 10 Oct 2023 10:31:56 -0400 Subject: [PATCH] adds helpful messages to solve #24 --- jax_omeroutils/intake.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jax_omeroutils/intake.py b/jax_omeroutils/intake.py index 63ff30f..a9729ee 100644 --- a/jax_omeroutils/intake.py +++ b/jax_omeroutils/intake.py @@ -130,9 +130,19 @@ def load_md_from_file(md_filepath, sheet_name=0): if 'project' in md.columns: md = md.dropna(subset=['filename', 'project', 'dataset'])\ .dropna(axis='columns', how='all') + if md.empty: + logger.error('Your spreadsheet rows need to contain ' + + 'filename, project and dataset names. Cannot ' + + 'proceed with import.') + raise ValueError('Spreadsheet needs filename, project and dataset') elif 'screen' in md.columns: md = md.dropna(subset=['filename', 'screen'])\ .dropna(axis='columns', how='all') + if md.empty: + logger.error('Your spreadsheet rows need to contain ' + + 'filename and screen names. Cannot ' + + 'proceed with import.') + raise ValueError('Spreadsheet needs filename and screen') # protect against extra spaces on 'omero user' and 'omero group' md_header.index = md_header.index.str.strip()