diff --git a/comtypes/__init__.py b/comtypes/__init__.py index f48654576..fed0f0710 100644 --- a/comtypes/__init__.py +++ b/comtypes/__init__.py @@ -4,7 +4,15 @@ import atexit from ctypes import * from ctypes import _SimpleCData -from _ctypes import COMError +try: + from _ctypes import COMError +except ImportError as e: + msg = "\n".join(( + "COM technology not available (maybe it's the wrong platform).", + "Note that COM is only supported on Windows.", + "For more details, please check: " + "https://learn.microsoft.com/en-us/windows/win32/com")) + raise ImportError(msg) from e import logging import os import sys