diff options
author | Giampaolo Rodola' <g.rodola@gmail.com> | 2010-03-02 21:21:55 +0000 |
---|---|---|
committer | Giampaolo Rodola' <g.rodola@gmail.com> | 2010-03-02 21:21:55 +0000 |
commit | 95c37559177bec9aee5e7a76d9cc5565792f38d1 (patch) | |
tree | 0f29ee6cf5276b91d65e263c15fcb895b3d91eeb | |
parent | 9a4fa96b5c6086bee0ff123941662ceeaeda026f (diff) | |
download | psutil-95c37559177bec9aee5e7a76d9cc5565792f38d1.tar.gz |
Fixed a problem related with issue 24: ERROR_ACCESS_DENIED and ERROR_INVALID_PARAMETER was raised on Python 2.4 since in that python version those errors were still not mapped in errno module error codes.release-0.1.3
-rw-r--r-- | psutil/_psmswindows.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/psutil/_psmswindows.py b/psutil/_psmswindows.py index b846e13c..13bf6e78 100644 --- a/psutil/_psmswindows.py +++ b/psutil/_psmswindows.py @@ -23,6 +23,8 @@ NUM_CPUS = _psutil_mswindows.get_num_cpus() _UPTIME = _psutil_mswindows.get_system_uptime() TOTAL_PHYMEM = _psutil_mswindows.get_total_phymem() +ERROR_ACCESS_DENIED = 5 +ERROR_INVALID_PARAMETER = 87 # --- public functions @@ -63,7 +65,7 @@ def wrap_privileges(callable): try: return callable(*args, **kwargs) except OSError, err: - if err.errno == errno.EACCES: + if err.errno in (errno.EACCES, ERROR_ACCESS_DENIED): raise AccessDenied raise return wrapper @@ -94,7 +96,7 @@ class Impl(object): return _psutil_mswindows.kill_process(pid) except OSError, err: # work around issue #24 - if (pid == 0) and (err.errno == errno.EINVAL): + if (pid == 0) and err.errno in (errno.EINVAL, ERROR_INVALID_PARAMETER): raise AccessDenied raise |