From beb3c0205861f3bbaf13042ab482a8517636a095 Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Thu, 19 Nov 2020 19:09:14 +0100
Subject: [PATCH] [bob.io.base.load] Raise a proper error if the file does not
 exist

---
 bob/io/base/__init__.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/bob/io/base/__init__.py b/bob/io/base/__init__.py
index 7f30f18..87e5213 100644
--- a/bob/io/base/__init__.py
+++ b/bob/io/base/__init__.py
@@ -140,6 +140,8 @@ def load(inputs):
   from collections import Iterable
   import numpy
   if _is_string(inputs):
+    if not os.path.exists(inputs):
+      raise RuntimeError(f"`{inputs}' does not exist!")
     return File(inputs, 'r').read()
   elif isinstance(inputs, Iterable):
     retval = []
-- 
GitLab