From c617dbe6d8c0dfef139bc5702b6fe9f6dbdf893f Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 8 Dec 2014 20:00:46 +0300 Subject: [PATCH] Fall back to getuid if geteuid is not available It appears to be missing in PyPy3 --- powerline/segments/common/env.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/powerline/segments/common/env.py b/powerline/segments/common/env.py index f6c49c55..7c3a79e0 100644 --- a/powerline/segments/common/env.py +++ b/powerline/segments/common/env.py @@ -134,8 +134,13 @@ except ImportError: except ImportError: from getpass import getuser as _get_user else: + try: + from os import geteuid as getuid + except ImportError: + from os import getuid + def _get_user(): - return pwd.getpwuid(os.geteuid()).pw_name + return pwd.getpwuid(getuid()).pw_name username = False