From: Syver E. <syv...@on...> - 2002-01-24 10:38:48
|
Syver Enstad <syv...@on...> writes: > Here's a quick hack os.popen, it only works for reading at the time, > but would be easy to fix I believe. > > def popen(path, mode='r'): > r = java.lang.Runtime.getRuntime() > p = r.exec(path) > if mode == 'w': > return org.python.core.PyFile(p.getInputStream()) > elif mode == 'r': > return org.python.core.PyFile(p.getOutputStream()) > else: > raise OSError(0, "Invalid mode", mode) the only trouble I have so far is that the right ctor for PyFile doesn't seem to be because, the PyFile returned is always a PyFile in read mode, even though PyFile has one ctor for java.io.InputStream and one for java.io.OutputStream. -- Vennlig hilsen Syver Enstad |