summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/dist.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/dist.py')
-rw-r--r--Lib/distutils/dist.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py
index f7fac08..11f6ff8 100644
--- a/Lib/distutils/dist.py
+++ b/Lib/distutils/dist.py
@@ -4,11 +4,11 @@ Provides the Distribution class, which represents the module distribution
being built/installed/distributed.
"""
-import sys, os, re
+import importlib, sys, os, re
try:
import warnings
-except ImportError:
+except ModuleNotFoundError:
warnings = None
from distutils.errors import *
@@ -788,9 +788,8 @@ Common commands: (see '--help-commands' for more)
klass_name = command
try:
- __import__ (module_name)
- module = sys.modules[module_name]
- except ImportError:
+ module = importlib.import_module(module_name)
+ except ModuleNotFoundError:
continue
try: