GiulioRossetti / cdlib

Community Discovery Library
http://cdlib.readthedocs.io
BSD 2-Clause "Simplified" License
367 stars 71 forks source link

`infomap` ImportError not catched by `cdlib` in [crisp_partition.py, bipartite_clustering.py] in light version #204

Closed dummyindex closed 2 years ago

dummyindex commented 2 years ago

Hi cdlib team,

Thanks for fixing the import issue mentioned in #201 . There is probably one more little code issue to be fixed.

Describe the bug

try:
    import infomap as imp
except ModuleNotFoundError:
    missing_packages.add("infomap")
    imp = None

This does not catch ImportError, which is the case in my environment. After capturing Exception (all exception) in crisp_partition.py, bipartite_clustering.py (two files), I can import cdlib.algorithms without other issues.

To Reproduce Steps to reproduce the behavior:

Screenshots image

Yquetzal commented 2 years ago

Thanks for the fix and code cleaning, @GiulioRossetti the pull request seems OK to me...