Hi all, I'm working on an interpreter for a university subject, which is programmed in python under linux. I got most of the work done and I'm just trying to settle some problems I've found on my way. Right now, the most important is reading the user input. Everything goes through the standard input, and now I got something like this:
numline=0 for line in sys.stdin: numline+=1 workwithline(line) A little bit more complex, but that's the idea. That will work if the user does something like "./myprog.py < code" or "cat code | ./myprog.py", and that's ok, but if the user only does "./myprog.py" then I got to get into interactive mode and show a prompt in every line expecting the user input for that line. Problem is I don't know how to tell if I've been "piped" or not. I used to think that the piped program doesn't know anything and it's just OS dependant to close and open the right descriptors, but I'm not sure anymore. Any help or pointer in the right direction would be greatly appreciated. Happy christmas everyone, RGB -- http://mail.python.org/mailman/listinfo/python-list