Announcing: python-ghostscript 0.3
Aahz
aahz at pythoncraft.com
Thu Aug 12 15:32:54 EDT 2010
In article <alpine.DEB.1.10.1008121733280.3749 at localhost>,
Peter Kleiweg <p.c.j.kleiweg at rug.nl> wrote:
>Hartmut Goebel schreef op de 12e dag van de oogstmaand van het jaar 2010:
>
>> Here is an example for how to use the high-level interface of
>> `python-ghostscript`. This implements a very basic ps2pdf-tool::
>>
>> import sys
>> import ghostscript
>>
>> args = [
>> "ps2pdf", # actual value doesn't matter
>> "-dNOPAUSE", "-dBATCH", "-dSAFER",
>> "-sDEVICE=pdfwrite",
>> "-sOutputFile=" + sys.argv[1],
>> "-c", ".setpdfwrite",
>> "-f", sys.argv[2]
>> ]
>>
>> ghostscript.Ghostscript(*args)
>
>How is this different from os.system(' '.join(args)) ?
You don't have problems with shell metacharacters.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"...if I were on life-support, I'd rather have it run by a Gameboy than a
Windows box." --Cliff Wells
More information about the Python-list
mailing list