This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author snoiraud
Recipients
Date 2007-07-08.20:02:21
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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, ... )
History
Date User Action Args
2007-08-23 14:58:24adminlinkissue1750013 messages
2007-08-23 14:58:24admincreate