diff --git a/bob/io/base/__init__.py b/bob/io/base/__init__.py index cced69bcb98f5cc04a97b56dbf4a9d998f355eaf..7152f6c8f6c868183cf22652063c5509e570320d 100644 --- a/bob/io/base/__init__.py +++ b/bob/io/base/__init__.py @@ -193,19 +193,19 @@ def load(inputs): if _is_string(inputs): if not os.path.exists(inputs): raise RuntimeError(f"`{inputs}' does not exist!") - return open_file(inputs) + try: + return open_file(inputs) + except Exception as e: + raise RuntimeError(f"Could not load `{inputs}'!") from e elif isinstance(inputs, Iterable): retval = [] for obj in inputs: if _is_string(obj): retval.append(load(obj)) - # elif isinstance(obj, File): - # retval.append(obj.read()) else: raise TypeError( - "Iterable contains an object which is not a filename nor a " - "bob.io.base.File." + "Iterable contains an object which is not a filename" ) return numpy.vstack(retval) else: