only ever catch ImportError (#69792)
ModuleNotFoundError is a subclass of ImportError but only exists in Python 3.6 or newer. Instead of doing hacks to be able to catch that on older Pythons, just always only catch ImportError, which will also catch ModuleNotFoundError on Python 3.6 or later
This commit is contained in:
parent
80f09efd03
commit
e10e5fc4ad
1 changed files with 1 additions and 7 deletions
|
@ -50,12 +50,6 @@ try:
|
|||
except ImportError:
|
||||
import imp
|
||||
|
||||
try:
|
||||
ModuleNotFoundError
|
||||
except NameError:
|
||||
# this was introduced in Python 3.6
|
||||
ModuleNotFoundError = None
|
||||
|
||||
display = Display()
|
||||
|
||||
_tombstones = None
|
||||
|
@ -493,7 +487,7 @@ class PluginLoader:
|
|||
# FIXME: there must be cheaper/safer way to do this
|
||||
try:
|
||||
pkg = import_module(acr.n_python_package_name)
|
||||
except (ImportError, ModuleNotFoundError):
|
||||
except ImportError:
|
||||
return plugin_load_context.nope('Python package {0} not found'.format(acr.n_python_package_name))
|
||||
|
||||
pkg_path = os.path.dirname(pkg.__file__)
|
||||
|
|
Loading…
Add table
Reference in a new issue