summaryrefslogtreecommitdiff
path: root/src/python/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py
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/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py
parentc6b5f941e94fdabb3649637d195d3d85c645796b (diff)
Use exceptions uinstead of error message for non existing files
Diffstat (limited to 'src/python/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py')
-rwxr-xr-xsrc/python/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/python/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py b/src/python/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py
index aaa03dad..58cb2bb5 100755
--- a/src/python/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py
+++ b/src/python/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py
@@ -1,12 +1,15 @@
#!/usr/bin/env python
import argparse
+import errno
+import os
import matplotlib.pyplot as plot
-import sys
import gudhi
-""" 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
@@ -79,6 +82,7 @@ with open(args.file, "r") as f:
gudhi.plot_persistence_diagram(diag, band=args.band)
plot.show()
else:
- print(args.file, "is not a valid OFF file", file=sys.stderr)
+ raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT),
+ args.file)
f.close()