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 Exception.__init
__(self
)
21 self
.program
= program
24 def runProgram(prog
, input=None):
25 debug('runProgram prog: ' + str(prog
) + " input: " + str(input))
29 progStr
= ' '.join(prog
)
32 pop
= subprocess
.Popen(prog
,
33 shell
= type(prog
) is str,
34 stderr
=subprocess
.STDOUT
,
35 stdout
=subprocess
.PIPE
,
36 stdin
=subprocess
.PIPE
)
38 debug("strerror: " + e
.strerror
)
39 raise ProgramError(progStr
, e
.strerror
)
42 pop
.stdin
.write(input)
45 out
= pop
.stdout
.read()
48 debug("error output: " + out
)
49 raise ProgramError(progStr
, out
)
50 debug("output: " + out
.replace('\0', '\n'))