diff options
author | Vincent Rouvreau <vincent.rouvreau@inria.fr> | 2022-04-06 10:54:23 +0200 |
---|---|---|
committer | Vincent Rouvreau <vincent.rouvreau@inria.fr> | 2022-04-06 10:54:23 +0200 |
commit | 55b15a7c8617b770b51f61861951005a3e989327 (patch) | |
tree | cb1da29db321312b195754e97455e7ca9d4285dd /src | |
parent | e957f640d4653fc13458a232435761c5a184b05c (diff) |
code review: Rewrite warnings in case of import errors
Diffstat (limited to 'src')
-rw-r--r-- | src/python/gudhi/persistence_graphical_tools.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/python/gudhi/persistence_graphical_tools.py b/src/python/gudhi/persistence_graphical_tools.py index 70d550ab..3c166a56 100644 --- a/src/python/gudhi/persistence_graphical_tools.py +++ b/src/python/gudhi/persistence_graphical_tools.py @@ -97,8 +97,8 @@ def _matplotlib_can_use_tex(): from matplotlib import checkdep_usetex return checkdep_usetex(True) - except ImportError: - warnings.warn("This function is not available, you may be missing matplotlib.") + except ImportError as import_error: + warnings.warn(f"This function is not available.\nModuleNotFoundError: No module named '{import_error.name}'.") def plot_persistence_barcode( @@ -233,8 +233,8 @@ def plot_persistence_barcode( axes.axis([axis_start, infinity, 0, ind]) return axes - except ImportError: - warnings.warn("This function is not available, you may be missing matplotlib.") + except ImportError as import_error: + warnings.warn(f"This function is not available.\nModuleNotFoundError: No module named '{import_error.name}'.") def plot_persistence_diagram( @@ -384,8 +384,8 @@ def plot_persistence_diagram( axes.axis([axis_start, axis_end, axis_start, infinity + delta / 2]) return axes - except ImportError: - warnings.warn("This function is not available, you may be missing matplotlib.") + except ImportError as import_error: + warnings.warn(f"This function is not available.\nModuleNotFoundError: No module named '{import_error.name}'.") def plot_persistence_density( @@ -549,5 +549,5 @@ def plot_persistence_density( return axes - except ImportError: - warnings.warn("This function is not available, you may be missing matplotlib and/or scipy.") + except ImportError as import_error: + warnings.warn(f"This function is not available.\nModuleNotFoundError: No module named '{import_error.name}'.") |