User Tools

Site Tools


programming:python:better_getpass

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revisionBoth sides next revision
programming:python:better_getpass [2008/10/15 20:25] – created crustymonkeyprogramming:python:better_getpass [2008/10/16 15:23] crustymonkey
Line 12: Line 12:
     the openssh client     the openssh client
     """     """
-    if not os.isatty(sys.stdout.fileno()):+    if not os.isatty(sys.stderr.fileno()):
         raise IOError , 'You can only call getPass() from a tty'         raise IOError , 'You can only call getPass() from a tty'
-    ttyname = os.ttyname(sys.stdout.fileno())+    ttyname = os.ttyname(sys.stderr.fileno())
     ttyh = open(ttyname , 'w+b')     ttyh = open(ttyname , 'w+b')
     ttyfd = ttyh.fileno()     ttyfd = ttyh.fileno()
programming/python/better_getpass.txt · Last modified: 2010/07/23 15:38 by jay