pipes and popen2

Stian Husemoen stianh at ifi.uio.no
Tue Jun 13 04:08:47 EDT 2000


I was a bit bored this weekend, and passed time coding python. In one
snippet I wanted to make a UI to ispell. The idea was to create a
bidirectional pipe, keep that pipe open, and feed ispell with words to
spell. Like in this pseudo-code:

	stdout, stdin = popen2.popen2('ispell -a')
	
	for word in wordlist:
		# spell this
		stdin.write('pyhton')

		# result
		print stdin.readline()

Problem is popen2 wont give me any output until I close stdin. Is there any
way to both read and write to a program while keeping the pipe and
process open? I can't seem to find any postings or documentation on this
subject.


Cut-down-a-tree-with-a-herring?-It-cant-be-done-ly y'rs
-- 

Stian Husemoen <stianh>



More information about the Python-list mailing list