Message11104

Author jamesmudd
Recipients jamesmudd, pguermo, stefan.richthofer, zyasoft
Date 2017-02-20.21:09:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487624977.68.0.952459593826.issue2534@psf.upfronthosting.co.za>
In-reply-to
Content
Your right it fails for me in CPython as well in the same way on Ubuntu 16.04 64 bit

Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getlogin()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 2] No such file or directory
>>> 

This is discussed in the Python docs https://docs.python.org/2/library/os.html#os.getlogin where they suggest using the environment variable 'LOGNAME' or "pwd.getpwuid(os.getuid())[0]" both appear to work correctly in Jython, so maybe these are more reliable approaches which should be used instead.

Jython 2.7.1b3 (, Feb 19 2017, 19:57:56) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_121
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getenv('LOGNAME')
'james'
>>> import pwd
>>> pwd.getpwuid(os.getuid())[0]
'james'
>>> 

So I think this issue should be closed as the Jython behaviour seems consistent with CPython? I don't really like the idea of adding the fallbacks to PosixModule think it's quite clean as it is.
History
Date User Action Args
2017-02-20 21:09:37jamesmuddsetmessageid: <1487624977.68.0.952459593826.issue2534@psf.upfronthosting.co.za>
2017-02-20 21:09:37jamesmuddsetrecipients: + jamesmudd, zyasoft, stefan.richthofer, pguermo
2017-02-20 21:09:37jamesmuddlinkissue2534 messages
2017-02-20 21:09:37jamesmuddcreate