|
@@ -225,7 +225,12 @@ def user_groups_as_string():
|
|
|
if sys.platform != "win32":
|
|
if sys.platform != "win32":
|
|
|
euid = os.geteuid()
|
|
euid = os.geteuid()
|
|
|
egid = os.getegid()
|
|
egid = os.getegid()
|
|
|
- username = pwd.getpwuid(euid)[0]
|
|
|
|
|
|
|
+ try:
|
|
|
|
|
+ username = pwd.getpwuid(euid)[0]
|
|
|
|
|
+ except Exception:
|
|
|
|
|
+ # name of user not found
|
|
|
|
|
+ s = "user=(%d) group=(%d)" % (euid, egid)
|
|
|
|
|
+ return s
|
|
|
gids = os.getgrouplist(username, egid)
|
|
gids = os.getgrouplist(username, egid)
|
|
|
groups = []
|
|
groups = []
|
|
|
for gid in gids:
|
|
for gid in gids:
|