Calling Ghostscript from Python

Kerstin Dressler kerstin.dressler at web.de
Fri Nov 9 08:34:43 EST 2001


Georg Bisseling <Georg.Bisseling at pallas.com> wrote:
>Kerstin wrote:
>> 
>> Hi,
>> 
>> 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
>> os.system(cmd)
>> 
>> 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?
>> Thanx,
>> Kerstin
>
>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.


That's not working.
Also I have another file with full pathname ("c:\python21\programs\ps2pdf\input.
txt") where it was working before.
At the moment I don't need to be platform independent, it's a script for WinNT. 
But anyway, would this be right then:
path_ghost = os.path.join('c:\\ghost\\gs\\gs7.00\\lib') ?


Kerstin



-- 
__________________________________________________________
News suchen, lesen, schreiben mit http://newsgroups.web.de



More information about the Python-list mailing list