Calling Ghostscript from Python

Achim Domma achim.domma at syynx.de
Fri Nov 9 11:21:44 EST 2001


Hi Kerstin,

"Kerstin Dressler" <kerstin.dressler at web.de> wrote in message
news:3bebe987$1 at netnews.web.de...
> Georg Bisseling <Georg.Bisseling at pallas.com> wrote:
> >Kerstin wrote:
> >> ghost_dir = 'c:\ghost\gs\gs7.00\lib'
> >> cmd = ghost_dir + '\ps2pdf13.bat ' + ps_file + ' ' + pdf_file
> >> os.system(cmd)
[...]
> That's not working.
> Also I have another file with full pathname
("c:\python21\programs\ps2pdf\input.
> txt") where it was working before.

'\' marks special meaning for some following characters. For example '\n'
means a linebreak. But if there's no special meaning for a character (for
example '\g') the '\' is taken as a 'normal \'. Where do your ps_file or
pdf_file come from ? Is it possible that they contain special escape
sequences like '\n' or '\t' like 'myFolder\test.txt' ? To check this simply
write a 'print cmd' befor you call 'os.system(cmd)'. Does the string looks
like you expected it ?

greetings
Achim





More information about the Python-list mailing list