Skript that reads from Unix Pipe _AND_ interacts by getkey()

schwerdy schwerdy at web.de
Mon Oct 27 11:11:43 EST 2003


> Is it possible to create a skript, that can read from a unix pipe
> (eg.: "find -type f -name "*.ogg" | myscript.py"), _AND_ interact with
> the user by waiting for keypress (eg.: getkey() funktion of a curses
> screen)?

I resolved this issue by myself, but I don't know if this is too Quick&Dirty:

import sys
lines = sys.stdin.readlines()
sys.stdin.close()
sys.stdin = open('/dev/tty','r')

that's it. The disadvantage of this is, that the skript now only runs on unix :-(




More information about the Python-list mailing list