[NEWBIE] How to call an external program

Ulrich Petri ulope at gmx.de
Thu Sep 18 14:41:27 CEST 2003

"Philipp Neuhaus" <mailto:philipp.neuhaus at uni-muenster.de> schrieb im
Newsbeitrag news:2f9jmvcct6ai7dcg1ghhmm6bc7beuo18h0 at 4ax.com...
> Hi,
> I want to convert an image file, so I have to call an external
> program.
> How can I do this?
> (i want to call "sfftobmp -tifs input tempfile" and "tiff2ps tempfile*
> | ps2pdf [output]")

-----code---cut here----
import os

def convertImage(infile, outfile):
    os.system('sfftobmp -tifs %s tempfile' % infile)
    os.system('tiff2ps tempfile* | ps2pdf %s' % outfile)

convertImage('/home/user/in.tif', '/home/user/out.pdf')
-----code---cut here----


Ciao Ulrich

More information about the Python-list mailing list