Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ModuleNotFoundError on windows #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/gryffin/utilities/infos.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/env python

import resource
import sys
try:
import resource
except ModuleNotFoundError:
pass
import platform


def parse_time(start, end):
Expand All @@ -18,7 +21,9 @@ def parse_time(start, end):


def memory_usage():
if sys.platform == 'darwin': # MacOS --> memory in bytes
if platform.system() == 'Windows':
return 0, 0, 0
elif platform.system() == 'Darwin': # MacOS --> memory in bytes
kB = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss // 1000.
else: # Linux --> memory in kilobytes
kB = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
Expand Down