A completely silly question

Keith Dart kdart at kdart.com
Sun Dec 19 18:15:40 EST 2004


Mike Meyer wrote:
> Craig Ringer <craig at postnewspapers.com.au> writes:
> 
> 
>>On Sat, 2004-12-18 at 00:40, Amir Dekel wrote:
>>
>>>This must be the silliest question ever:
>>>
>>>What about user input in Python? (like stdin)
>>>Where can I find it? I can't find any references to it in the documentation.
>>
>>Under UNIX, I generally either use curses, or just put the terminal into
>>raw mode:
>>
>>.>>> def sane():
>>....    os.system("stty sane")
>>....
>>.>>> def raw():
>>....    os.system("stty raw")
> 
> 
> The termios gives module gives you the tools to manipulate the tty
> directly, without invoking stty. The tty module gives you an easier
> interface to those routines. However, it's missing a setsane
> functions. Hmm. I think it's time for another PEP.
> 
>            <mike

In the pyNMS package (http://sourceforge.net/projects/pynms/) there is a 
module called "termtools". This module can be used in place of the "tty" 
module. It has many improvements, including a "sane" function, a "raw" 
function, and an "stty" function. This module also replaces the 
"getpass" module, as it has the same functions found there. The PagedIO 
object is used by the CLI framework in pyNMS.






-- 
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Keith Dart <kdart at kdart.com>
    public key: ID: F3D288E4
    =====================================================================



More information about the Python-list mailing list