Bugs item #1750013, was opened at 2007-07-08 22:02 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1750013&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Serge Noiraud (snoiraud) Assigned to: Nobody/Anonymous (nobody) Summary: os.getlogin should use the DISPLAY and not the tty Initial Comment: 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, ... ) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1750013&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com