Skip to content

Commit 03c244b

Browse files
CristiFatijunkmd
authored andcommitted
Improve error message on non Win (enthought#423)
* Improve COM error message * Drop Py2 stuff * Remove dot * Remove empty line (cherry picked from commit 18cafb0)
1 parent 9d3906e commit 03c244b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

comtypes/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
import atexit
55
from ctypes import *
66
from ctypes import _SimpleCData
7-
from _ctypes import COMError
7+
try:
8+
from _ctypes import COMError
9+
except ImportError as e:
10+
msg = "\n".join((
11+
"COM technology not available (maybe it's the wrong platform).",
12+
"Note that COM is only supported on Windows.",
13+
"For more details, please check: "
14+
"https://learn.microsoft.com/en-us/windows/win32/com"))
15+
raise ImportError(msg) from e
816
import logging
917
import os
1018
import sys

0 commit comments

Comments
 (0)