Jython: Functionality equivalent to popen()

Andreas Ulbrich ulbi at ivs.tu-berlin.de
Tue Aug 6 12:29:53 CEST 2002

Irene wrote:
> I see that it is a known bug that os.popen() is not implemented in
> Jython.  Does anyone have any suggestions for a workaround or any

I wouldn't call it a bug. It's just a non-feature :-)

> other way of sending a command to the command line or an idea of when
> it might be implemented?
> I know, I know, if you are going to complain about something, you
> should just implement it yourself, but I wouldn't even have a clue
> where to begin. :)
> Irene Shaw

java.lang.Runtime (exec methods) and java.lang.Process contain all you 
need. If you like you can wrap it into something like popen:

def popen(cmd) :
	proc = Runtime.getRuntime().exec(cmd)
	return (proc.inputStream, proc.outputStream)

I happen to not like it as you loose the other methods of Process.

More information about the Python-list mailing list