diff --git a/win32/Lib/pywin32_bootstrap.py b/win32/Lib/pywin32_bootstrap.py index b13add363..686a59a8f 100644 --- a/win32/Lib/pywin32_bootstrap.py +++ b/win32/Lib/pywin32_bootstrap.py @@ -6,7 +6,6 @@ # modules are imported. # If Python has `os.add_dll_directory()`, we need to call it with this path. # Otherwise, we add this path to PATH. -import os try: @@ -14,6 +13,7 @@ except ImportError: # Python ≥3.6: replace ImportError with ModuleNotFoundError pass else: + import os # We're guaranteed only that __path__: Iterable[str] # https://docs.python.org/3/reference/import.html#__path__ for path in pywin32_system32.__path__: