Browse Source

Catch ImportError rather than ModuleNotFoundError

In some cases, this is useful, e.g.:

ImportError: cannot import name 'replace_me' from 'dissolve' (unknown location)
Jelmer Vernooij 2 tháng trước cách đây
mục cha
commit
1441b35f70
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      dulwich/__init__.py

+ 1 - 1
dulwich/__init__.py

@@ -29,7 +29,7 @@ __all__ = ["replace_me"]
 
 try:
     from dissolve import replace_me
-except ModuleNotFoundError:
+except ImportError:
     # if dissolve is not installed, then just provide a basic implementation
     # of its replace_me decorator
     def replace_me(since=None, remove_in=None):