From 28307a22309530ce90f7cf85ab813bcfa4ccb262 Mon Sep 17 00:00:00 2001 From: ruppert Date: Wed, 12 Sep 2012 13:17:08 +0000 Subject: [PATCH] FIX: psutil problem --- invesalius/utils.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/invesalius/utils.py b/invesalius/utils.py index 6f22531..9fe6312 100755 --- a/invesalius/utils.py +++ b/invesalius/utils.py @@ -224,9 +224,15 @@ def calculate_resizing_tofitmemory(x_size,y_size,n_slices,byte): # USING PSUTIL import psutil - ram_free = psutil.phymem_usage().free + psutil.cached_phymem() + psutil.phymem_buffers() - ram_total = psutil.phymem_usage().total - swap_free = psutil.virtmem_usage().free + if (psutil.version_info<(0,6,0)): + ram_free = psutil.phymem_usage().free + psutil.cached_phymem() + psutil.phymem_buffers() + ram_total = psutil.phymem_usage().total + swap_free = psutil.virtmem_usage().free + else: + ram_free = psutil.virtual_memory().available + ram_total = psutil.virtual_memory().total + swap_free = psutil.swap_memory().free + print "RAM_FREE=", ram_free print "RAM_TOTAL=", ram_total -- libgit2 0.21.2