pty difficulties

Josiah Carlson jcarlson at nospam.uci.edu
Sat Jan 24 04:01:11 EST 2004


>         while True:
>             readable = select(connections.keys(), [], [])[0]
>             for f in readable:
>                 data = read(f.fileno(), 1024)
>                 connections[f].write(data)
>                 connections[f].flush()

I believe your problem exists in the write and flush.  All you seem to 
be doing is checking to see if your reading file handles are capable of 
reading, you never check to see if you can write to anything.  Your lisp 
interpreter showcases the fact that it is not ready to get a write while 
it is interpreting, by failing.  I believe the following should fix you up:

         while True:
             readable = select(connections.keys(), [], [])[0]
             for f in readable:
                 if select([], [connections[f]], [], 0)[1]:
                     data = read(f.fileno(), 1024)
                     connections[f].write(data)
                     connections[f].flush()

  - Josiah



More information about the Python-list mailing list