Package glue :: Package nmi :: Module util
[hide private]
[frames] | no frames]

Source Code for Module glue.nmi.util

 1  import os 
 2  import pwd 
 3   
 4   
5 -def existsInPath(name):
6 for dir in os.getenv('PATH').split(os.pathsep): 7 fullname = os.path.join(dir, name) 8 if os.path.exists(fullname): return fullname
9 10 11 # this get_username() is more robust than os.getenv('USERNAME') or 12 # getpass.getuser(), because the latter rely on the user's environment 13 # and thus cannot be trusted, since the underlying variables can be 14 # (accidentally or intentionally) removed or changed. 15
16 -def get_username():
17 return pwd.getpwuid(os.getuid()).pw_name
18