os.getuid() is not supported by windows

This commit is contained in:
Oleksii Shevchuk 2017-06-03 21:36:44 +03:00
parent a8ea635599
commit 7ac9ab73b5
1 changed files with 7 additions and 1 deletions

View File

@ -143,7 +143,13 @@ class PStore(object):
return cls._instance
def __init__(self, pstore_dir='~'):
seed = '{}:{}'.format(os.getuid(), uuid.getnode())
try:
import getpass
uid = getpass.getuser()
except:
uid = os.getuid()
seed = '{}:{}'.format(uid, uuid.getnode())
h = hashlib.sha1()
h.update(seed)