<[EMAIL PROTECTED]> wrote:
> Hi, > > Thanks for your answer. I had a look into the fcntl module and tried > to unlock the output-file, but > > >>> fcntl.lockf(x.stdout, fcntl.LOCK_UN) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > IOError: [Errno 9] Bad file descriptor > > I wonder why it does work with the sys.stdin It's really a pity, it's > the first time python does not work as expected. =/ > > Flushing the stdin did not help, too. its block, not lock, and one uses file.flush() after using file.write(), so the stdin is the wrong side - you have to push, you can't pull.. Here is the unblock function I use - it comes from the internet, possibly from this group, but I have forgotten who wrote it. # Some magic to make a file non blocking - from the internet def unblock(f): """Given file 'f', sets its unblock flag to true.""" fcntl.fcntl(f.fileno(), fcntl.F_SETFL, os.O_NONBLOCK) hope this helps - note that the f is not the file's name but the thing you get when you write : f = open(... - Hendrik -- http://mail.python.org/mailman/listinfo/python-list