Commit 28307a22309530ce90f7cf85ab813bcfa4ccb262

Authored by ruppert
1 parent 68249849

FIX: psutil problem

Showing 1 changed file with 9 additions and 3 deletions   Show diff stats
invesalius/utils.py
... ... @@ -224,9 +224,15 @@ def calculate_resizing_tofitmemory(x_size,y_size,n_slices,byte):
224 224  
225 225 # USING PSUTIL
226 226 import psutil
227   - ram_free = psutil.phymem_usage().free + psutil.cached_phymem() + psutil.phymem_buffers()
228   - ram_total = psutil.phymem_usage().total
229   - swap_free = psutil.virtmem_usage().free
  227 + if (psutil.version_info<(0,6,0)):
  228 + ram_free = psutil.phymem_usage().free + psutil.cached_phymem() + psutil.phymem_buffers()
  229 + ram_total = psutil.phymem_usage().total
  230 + swap_free = psutil.virtmem_usage().free
  231 + else:
  232 + ram_free = psutil.virtual_memory().available
  233 + ram_total = psutil.virtual_memory().total
  234 + swap_free = psutil.swap_memory().free
  235 +
230 236 print "RAM_FREE=", ram_free
231 237 print "RAM_TOTAL=", ram_total
232 238  
... ...