os.fdopen() issue in Python 3.1?

A

Albert Hopkins

I have a snippet of code that looks like this:

pid, fd = os.forkpty()
if pid == 0:
subprocess.call(args)
else:
input = os.fdopen(fd).read()
...


This seems to work find for CPython 2.5 and 2.6 on my Linux system.
However, with CPython 3.1 I get:

input = os.fdopen(fd).read()
IOError: [Errno 5] Input/output error

Is there something wrong in Python 3.1? Is this the correct way to do
this (run a process in a pseudo-tty and read it's output) or is there
another way I should/could be doing this?

-a
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,144
Latest member
KetoBaseReviews
Top