With Python 2.2 as installed on Redhat Linux 7.3, I get
the following error with pty.spawn.
----------- test-pty.py ------------
#!/usr/bin/python2
import os, sys, pty
sp = raw_input("Spawn a new process?")
if sp == 'y':
pty.spawn(('/bin/ls', '/etc'))
a = raw_input()
print a
------------ end code ---------------
Traceback (most recent call last):
File "test-pty.py", line 7, in ?
pty.spawn(('/bin/ls', '/etc'))
File "/usr/lib/python2.2/pty.py", line 160, in spawn
_copy(master_fd, master_read, stdin_read)
File "/usr/lib/python2.2/pty.py", line 144, in _copy
data = master_read(master_fd)
File "/usr/lib/python2.2/pty.py", line 133, in _read
return os.read(fd, 1024)
OSError: [Errno 5] Input/output error
------------------------------------
I have checked the CVS version, and it looks like it
will still give the same error.
I am about to submit a 1 line patch, which as far as I
can tell fixes the problem (at least for me). See the
patches tracker.
Rasjid.
|