4 # PyQt3 and python 2.4 isn't currently available together on
5 # Debian/testing we do therefore use the following quite ugly work
6 # around. The module 'mysubprocess' is just a copy of the 'subprocess'
7 # module from the Python 2.4 distribution.
9 if ver
[0] < 2 or (ver
[0] == 2 and ver
[1] <= 3):
11 subprocess
= mysubprocess
18 class ProgramError(Exception):
19 def __init__(self
, program
, err
):
20 self
.program
= program
23 def runProgram(prog
, input=None):
27 progStr
= ' '.join(prog
)
29 pop
= subprocess
.Popen(progStr
,
31 stderr
=subprocess
.STDOUT
,
32 stdout
=subprocess
.PIPE
,
33 stdin
=subprocess
.PIPE
)
35 debug("strerror: " + e
.strerror
)
36 raise ProgramError(progStr
, e
.strerror
)
39 pop
.stdin
.write(input)
42 out
= pop
.stdout
.read()
45 debug("error output: " + out
)
46 raise ProgramError(progStr
, out
)
47 debug("output: " + out
.replace('\0', '\n'))