From db31692ddf48abed1d02afc56eb33c8d7cd15234 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Thu, 13 Mar 2014 17:37:30 -0300 Subject: Support latest psutil version. --- changes/bug_update-psutil-version | 1 + src/leap/bitmask/services/eip/vpnprocess.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 changes/bug_update-psutil-version diff --git a/changes/bug_update-psutil-version b/changes/bug_update-psutil-version new file mode 100644 index 00000000..be9fedde --- /dev/null +++ b/changes/bug_update-psutil-version @@ -0,0 +1 @@ +Update requirements and code for the new psutil version. diff --git a/src/leap/bitmask/services/eip/vpnprocess.py b/src/leap/bitmask/services/eip/vpnprocess.py index 51f0f738..5c100036 100644 --- a/src/leap/bitmask/services/eip/vpnprocess.py +++ b/src/leap/bitmask/services/eip/vpnprocess.py @@ -19,14 +19,20 @@ VPN Manager, spawned in a custom processProtocol. """ import logging import os -import psutil -import psutil.error import shutil import socket import sys from itertools import chain, repeat +import psutil +try: + # psutil < 2.0.0 + from psutil.error import AccessDenied as psutil_AccessDenied +except ImportError: + # psutil >= 2.0.0 + from psutil import AccessDenied as psutil_AccessDenied + from PySide import QtCore from leap.bitmask.config.providerconfig import ProviderConfig @@ -672,7 +678,7 @@ class VPNManager(object): if any(map(lambda s: s.find("LEAPOPENVPN") != -1, p.cmdline)): openvpn_process = p break - except psutil.error.AccessDenied: + except psutil_AccessDenied: pass return openvpn_process -- cgit v1.2.3