diff options
| author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-11-08 21:12:10 +0100 |
|---|---|---|
| committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-11-08 21:12:10 +0100 |
| commit | 6cf015146b23c402f822489884ebcef8b46ec58b (patch) | |
| tree | 40ec1b5e671dddee0a43f559cc611a6773b03093 /psutil/_pswindows.py | |
| parent | a2a9de79cb6104baabaaf1f4b6d735de6627354e (diff) | |
| download | psutil-6cf015146b23c402f822489884ebcef8b46ec58b.tar.gz | |
#811: move DLL check logic in _pswindows.py
Diffstat (limited to 'psutil/_pswindows.py')
| -rw-r--r-- | psutil/_pswindows.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/psutil/_pswindows.py b/psutil/_pswindows.py index d956b91f..cb816f73 100644 --- a/psutil/_pswindows.py +++ b/psutil/_pswindows.py @@ -12,7 +12,25 @@ import sys from collections import namedtuple from . import _common -from . import _psutil_windows as cext +try: + from . import _psutil_windows as cext +except ImportError as err: + if str(err).lower().startswith("dll load failed") and \ + sys.getwindowsversion()[0] < 6: + # We may get here if: + # 1) we are on an old Windows version + # 2) psutil was installed via pip + wheel + # See: https://github.com/giampaolo/psutil/issues/811 + # It must be noted that psutil can still (kind of) work + # on outdated systems if compiled / installed from sources, + # but if we get here it means this this was a wheel (or exe). + msg = "this Windows version is too old (< Windows Vista); " + msg += "psutil 3.4.2 is the latest version which supports Windows " + msg += "2000, XP and 2003 server" + raise RuntimeError(msg) + else: + raise + from ._common import conn_tmap from ._common import isfile_strict from ._common import parse_environ_block |
