diff options
author | Predrag Ivanović <pedja> | 2019-04-30 15:05:44 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-04-30 15:05:44 +0300 |
commit | 89568c1a42eb894d4c4b51dbc0a896f20a64bcfe (patch) | |
tree | 01577a258aa9c9384c2de82309f1be365054e049 /ant_landscape | |
parent | 7274975940af4e588820f2df28e91e68b4e729a5 (diff) |
Fix T63982: A.N.T. Landscape add-on broken after psutil API change
Differential Revision: https://developer.blender.org/D4759
Diffstat (limited to 'ant_landscape')
-rw-r--r-- | ant_landscape/stats.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ant_landscape/stats.py b/ant_landscape/stats.py index 77759804..1d6d485c 100644 --- a/ant_landscape/stats.py +++ b/ant_landscape/stats.py @@ -25,14 +25,22 @@ class Stats: def _gettime(self): """return the time in seconds used by the current process.""" if psutil_available: - m=self.process.get_cpu_times() + """ Handle psutil API change. """ + if hasattr(self.process, "get_cpu_times"): + m = self.process.get_cpu_times() + else: + m = self.process.cpu_times() return m.user + m.system return time() def _getmem(self): """return the resident set size in bytes used by the current process.""" if psutil_available: - m = self.process.get_memory_info() + """ Handle psutil API change. """ + if hasattr(self.process, "get_memory_info"): + m = self.process.get_memory_info() + else: + m = self.process.memory_info() return m.rss return 0 |