summaryrefslogtreecommitdiff
path: root/src/python/gudhi/off_reader.pyx
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-02-06 10:51:43 +0100
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-02-06 10:51:43 +0100
commit24a76cc53c935dee93f2367f176143c015009e3f (patch)
tree29db475b3db31074108c8d178f421f34caf1824d /src/python/gudhi/off_reader.pyx
parentc6b5f941e94fdabb3649637d195d3d85c645796b (diff)
Use exceptions uinstead of error message for non existing files
Diffstat (limited to 'src/python/gudhi/off_reader.pyx')
-rw-r--r--src/python/gudhi/off_reader.pyx12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/python/gudhi/off_reader.pyx b/src/python/gudhi/off_reader.pyx
index 0a828b83..a3200704 100644
--- a/src/python/gudhi/off_reader.pyx
+++ b/src/python/gudhi/off_reader.pyx
@@ -1,5 +1,7 @@
-# This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
-# See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
+# This file is part of the Gudhi Library - https://gudhi.inria.fr/ -
+# which is released under MIT.
+# See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full
+# license details.
# Author(s): Vincent Rouvreau
#
# Copyright (C) 2016 Inria
@@ -11,7 +13,7 @@ from __future__ import print_function
from cython cimport numeric
from libcpp.vector cimport vector
from libcpp.string cimport string
-import sys
+import errno
import os
__author__ = "Vincent Rouvreau"
@@ -34,6 +36,6 @@ def read_points_from_off_file(off_file=''):
if os.path.isfile(off_file):
return read_points_from_OFF_file(off_file.encode('utf-8'))
else:
- print("file " + off_file + " not found.", file=sys.stderr)
- return []
+ raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT),
+ off_file)