Используйте подпроцесс , он заменяет os.popen, хотя это не намного больше абстракции:
from subprocess import Popen, PIPE
output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0]
#this is how I'd mangle the arguments together
output = Popen([
self._ghostscriptPath,
'gswin32c',
'-q',
'-dNOPAUSE',
'-dBATCH',
'-sDEVICE=tiffg4',
'-r196X204',
'-sPAPERSIZE=a4',
'-sOutputFile="%s %s"' % (tifDest, pdfSource),
], stdout=PIPE).communicate()[0]
Если у вас есть только Python 2.3, в котором нет модуля подпроцесса, вы все равно можете использовать os.popen
os.popen(' '.join([
self._ghostscriptPath,
'gswin32c',
'-q',
'-dNOPAUSE',
'-dBATCH',
'-sDEVICE=tiffg4',
'-r196X204',
'-sPAPERSIZE=a4',
'-sOutputFile="%s %s"' % (tifDest, pdfSource),
]))