Message32463
Hi,
I have the following with gramps on kubuntu ( KDE ).
My terminals are "konsole". They don't register their pty
in utmp and I think they are correct. We are already logged. so if we register again for each konsole, we have a bad user count.
In these case, os.getlogin() return :
OSError: [Errno 2] No such file or directory
I think getlogin should use the DISPLAY instead of the tty when we get this error.
to correct this problem I use :
try:
user=os.getlogin()
except:
user=os.environ.get("USER")
but I'm not sure os.environ.get return the good value on every OSes ...
I have tested too :
except:
user = pwd.getpwuid(os.getuid())[0]
What is the best solution to this problem.
I looked at all bugs about getlogin and I saw we should avoid this function.
What is in this case the function we should use and which works correctly on every OS ( Linux, Unices, Windows, MAC OS/X, ... )
|
|
Date |
User |
Action |
Args |
2007-08-23 14:58:24 | admin | link | issue1750013 messages |
2007-08-23 14:58:24 | admin | create | |
|