mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Workaround for psutil API change
This commit is contained in:
parent
8169af0cdc
commit
8b777eb1d4
@ -21,6 +21,9 @@ def get_memory():
|
|||||||
'Return memory usage in bytes'
|
'Return memory usage in bytes'
|
||||||
import psutil
|
import psutil
|
||||||
p = psutil.Process(os.getpid())
|
p = psutil.Process(os.getpid())
|
||||||
|
if hasattr(p, 'memory_info_ex'):
|
||||||
|
mem = p.memory_info_ex()
|
||||||
|
else:
|
||||||
mem = p.get_ext_memory_info()
|
mem = p.get_ext_memory_info()
|
||||||
attr = 'wset' if iswindows else 'data' if islinux else 'rss'
|
attr = 'wset' if iswindows else 'data' if islinux else 'rss'
|
||||||
return getattr(mem, attr)
|
return getattr(mem, attr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user