~ubuntu-branches/ubuntu/wily/spyder/wily

« back to all changes in this revision

Viewing changes to spyderlib/utils/system.py

  • Committer: Package Import Robot
  • Author(s): Benjamin Drung
  • Date: 2015-01-15 12:20:11 UTC
  • mfrom: (18.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150115122011-cc7j5dhy2h9uo13m
Tags: 2.3.2+dfsg-1ubuntu1
Backport patch to support pylint3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
    return float(memorystatus.dwMemoryLoad)
38
38
 
39
39
def psutil_phymem_usage():
40
 
    """Return physical memory usage (float)
 
40
    """
 
41
    Return physical memory usage (float)
41
42
    Requires the cross-platform psutil (>=v0.3) library
42
 
    (http://code.google.com/p/psutil/)"""
 
43
    (http://code.google.com/p/psutil/)
 
44
    """
43
45
    import psutil
44
 
    return psutil.phymem_usage().percent
 
46
    # This is needed to avoid a deprecation warning error with
 
47
    # newer psutil versions
 
48
    try:
 
49
        percent = psutil.virtual_memory().percent
 
50
    except:
 
51
        percent = psutil.phymem_usage().percent
 
52
    return percent
45
53
 
46
54
if programs.is_module_installed('psutil', '>=0.3.0'):
47
55
    #  Function `psutil.phymem_usage` was introduced in psutil v0.3.0