-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
os.getlogin() not working #84998
Comments
Hi, user=os.getlogin() We got three RHEL linux systems with Python 3 and strangely on two of them this command works fine. However only on third system it is failing with below error OSError: [Errno 6] No such device or address Not sure if it is some o/s env setup which is causing this command to fail. Any pointers to run this command will be of great help so that we can pin point the issue. Please note on faiing system if I do python and then run the command it works fine without any issue. However if it is triggered through our Scheduler (Control M) it is failing with above message. Give below is the command how Scheduler triggers the job. /bin/su - edwadm -c /bin/sh -x <> Thanks |
On POSIX os.getlogin() is a thin wrapper around the glibc function getlogin() https://linux.die.net/man/3/getlogin . The error is coming from glibc. |
errno 6 is ENXIO. According to https://www.man7.org/linux/man-pages/man3/getlogin.3.html the error code means "The calling process has no controlling terminal.". os.getlogin() returns the name of the user logged in on the controlling terminal of the process. Typically processes in user session (tty, X session) have a controlling terminal. Processes spawned by a service manager like init, systemd, or upstart usually do not have a controlling terminal. You have to get the user information by other means. Our documentation for os.getlogin() recommends getpass.getuser(). |
* Update tacker from branch 'master' to 87ff1bddbac9e99d9bd1266ddd4df6ae3f2b7d5f - Use getpass.getuser() in test_privsep For some reasons method os.getlogin() is failing in Zuul CI in Centos8 job [1]. As recommended in [2], change method to getpass.getuser(). [1] https://review.rdoproject.org/zuul/build/bee7ccaba673409c82cc1f212311fdc2/log/job-output.txt [2] python/cpython#84998 (comment) Change-Id: I842dccc196c7611506f2115b4bea42bb406f2c3f
For some reasons method os.getlogin() is failing in Zuul CI in Centos8 job [1]. As recommended in [2], change method to getpass.getuser(). [1] https://review.rdoproject.org/zuul/build/bee7ccaba673409c82cc1f212311fdc2/log/job-output.txt [2] python/cpython#84998 (comment) Change-Id: I842dccc196c7611506f2115b4bea42bb406f2c3f
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: