[Tutor] Re: write to /dev/stdin during call to posix command?

Jeff Kowalczyk jtk at yahoo.com
Mon Sep 20 19:22:04 CEST 2004

Kent Johnson wrote:
| Did you try:
| pdfinput = open('sample.pdf','r').read()
| r,w,e = os.popen3('pdftotext -layout /dev/stdin -')
| r.write(pdfinput)

Yes, but a subsequent call to w.read() will hang until interrupted. I also
tried to w.seek(0) before reading. There doesn't seem to be any
communication between writing to r and the process awaiting stdin.

I ran a version with a file hardcoded in place of '-' (stdout) and it
didn't write anything, even an empty file.

More information about the Tutor mailing list