11 |
11 |
12 This module is a replacement for the one found in the Python distribution. It |
12 This module is a replacement for the one found in the Python distribution. It |
13 is to provide a debugger compatible variant of the a.m. functions. |
13 is to provide a debugger compatible variant of the a.m. functions. |
14 """ |
14 """ |
15 |
15 |
16 __all__ = ["getpass","getuser"] |
16 __all__ = ["getpass", "getuser"] |
|
17 |
17 |
18 |
18 def getuser(): |
19 def getuser(): |
19 """ |
20 """ |
20 Function to get the username from the environment or password database. |
21 Function to get the username from the environment or password database. |
21 |
22 |
35 |
36 |
36 # If this fails, the exception will "explain" why |
37 # If this fails, the exception will "explain" why |
37 import pwd |
38 import pwd |
38 return pwd.getpwuid(os.getuid())[0] |
39 return pwd.getpwuid(os.getuid())[0] |
39 |
40 |
|
41 |
40 def getpass(prompt='Password: '): |
42 def getpass(prompt='Password: '): |
41 """ |
43 """ |
42 Function to prompt for a password, with echo turned off. |
44 Function to prompt for a password, with echo turned off. |
43 |
45 |
44 @param prompt Prompt to be shown to the user (string) |
46 @param prompt Prompt to be shown to the user (string) |