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):
24 debug('runProgram prog: ' + str(prog
) + " input: " + str(input))
28 progStr
= ' '.join(prog
)
31 pop
= subprocess
.Popen(prog
,
32 shell
= type(prog
) is str,
33 stderr
=subprocess
.STDOUT
,
34 stdout
=subprocess
.PIPE
,
35 stdin
=subprocess
.PIPE
)
37 debug("strerror: " + e
.strerror
)
38 raise ProgramError(progStr
, e
.strerror
)
41 pop
.stdin
.write(input)
44 out
= pop
.stdout
.read()
47 debug("error output: " + out
)
48 raise ProgramError(progStr
, out
)
49 debug("output: " + out
.replace('\0', '\n'))