Subject: bug#14366: 24.3; Python os.getlogin does not work

From: [email-masked]
Date: Tue, 07 May 2013 23:19:10 -0400

Run python using:

M-x run-python (I used python 3.3.1). Once Python starts, run the
following:

import os
os.getlogin() and see the error

import os
>>> os.getlogin()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory

The above can be reproduced by running python in an emacs Shell too.

This does not happen when I run Python from normal shell (without
emacs):

Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getlogin()
'rajanikanth'

In GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu)
 of 2013-05-07 on ubuntu
System Description:	Ubuntu 13.04

Configured using:
 `configure '--prefix=/home/rajanikanth/EMACS-24/' '--without-x''

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Inferior Python

Minor modes in effect:
  compilation-shell-minor-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC [ > 1 ; 3 4 0 2 ; 0 c ESC x r u n - p y t h o n 
RET RET RET RET e x i t ( ) RET C-x 0 C-u ESC x r u 
n - p y t h o n RET DEL DEL DEL 3 . 3 TAB - i RET y 
i m p o r t SPC o s RET o s . g e t l o g i n ( ) RET 
ESC x r e p o r t - b u TAB RET

Recent messages:
("./emacs")
For information about GNU Emacs and the GNU system, type C-h C-a.
Sent python-shell-completion-setup-code
Sent python-ffap-setup-code
Sent python-eldoc-setup-code
Make dedicated process? (y or n)  y
Sent python-shell-completion-setup-code
Sent python-ffap-setup-code
Sent python-eldoc-setup-code

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils compile tool-bar python rx easymenu comint
regexp-opt ring ansi-color time-date ediff-hook vc-hooks lisp-float-type
tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow
timer jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer loaddefs button faces cus-face macroexp files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process multi-tty emacs)