How to logout from a Python Program?

Erik Max Francis max at alcyone.com
Thu Oct 10 23:23:15 CEST 2002


Wayne Pierce wrote:

> What about os.system("logout")?

logout is just a synonym for exit.  That will exit the subshell that was
fired up by os.system, not the parent shell that he wants to kill.

In this case, his best option is, as brutal as it sounds, to send a
signal to the parent process of the Python script (which would be his
main shell).  Unfortunately, in its standard configuration, an ssh
tunneled shell is likely to ignore TERM, so you might be forced to use
KILL, which makes the prospects even less satisfying.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Be able to be alone.  Lose not the advantage of solitude.
\__/ Sir Thomas Browne
    Lsystem / http://www.alcyone.com/pyos/lsystem/
 A Lindenmayer systems explorer in Python.



More information about the Python-list mailing list