Calling Ghostscript from Python
Georg.Bisseling at pallas.com
Fri Nov 9 15:22:38 CET 2001
> I'm trying to call the ghostscript to convert some PS to PDF. I'm
> working on Win95, so the os.system() always returns '0'.
> When the cmd is running, the DOS-Box opens and I get the error message
> "File or directory not found".
> I also checked if the PS are readable; and when I change the cmd to
> something else (like "md new_dir") it works.
> ghost_dir = 'c:\ghost\gs\gs7.00\lib'
> cmd = ghost_dir + '\ps2pdf13.bat ' + ps_file + ' ' + pdf_file
> I think there must be something wrong with the pathname or rather the
> ghost environment. How can I check this?
> I'm using full pathnames for 'ps_file' and 'pdf_file' too! Might this
> cause problems?
> Can anybody help me?
ghost_dir = 'c:\\ghost\\gs\\gs7.00\\lib'
cmd = ghost_dir + '\\ps2pdf13.bat ' + ps_file + ' ' + pdf_file
should do the trick.
You should use os.path.join to join pathnames platform independent.
More information about the Python-list