pipes and commands

Gregor Zych zych at pool.informatik.rwth-aachen.de
Sun Oct 31 16:21:29 EST 1999


Bernhard Herzog <herzog at online.de> writes:

> Gregor Zych <zych at pool.informatik.rwth-aachen.de> writes:
> 
> > > Gregor Zych <zych at pool.informatik.rwth-aachen.de> writes:
> > > 
> > > > Hi!
> > > > How can I get many commands connected with pipes executed. I try
> > > > 
> > > > startexe = 'gs -q -dNOPAUSE -sDEVICE=pbmraw -r600x600 -sOutputFile=- '+pfad+'/'+name+'.eps quit.ps | pnmcut 610 982 4023 5483 | pnmtotiff - > '+pfad+'/'+name+'.tif'
> > > > os.system(startexe)
> > > > 
> > > > but the system just waits for ever until I interrupt it, although it
> > > > gets the final file written correctly.
> 
> The first thing I do when I have problems with os.system() is to check
> whether the command works properly when run in an interactive shell.
> Have you tried that?
Yes.
> FWIW, I use the code below in Sketch to render preview images for
> embedded eps files. Apart from some postscript trickery to make sure the
> contents of the BoundingBox are positioned correctly and that showpage
> is executed exactly once, the only difference I can see in my code is
> that I use -c quit instead of quit.ps.
No difference.
> 
> To make sure that piping the output through some ppm-utility isn't the
> problem, I've just checked it by piping it through pnminvert and it
> worked as expected.
> 
> gs_command = ('gs -sDEVICE=ppmraw -r%(resolution)d -dNOPAUSE -dSAFER -q'
> 	      ' -sOutputFile=%(temp)s -g%(width)dx%(height)d'
                             ^^^^^^^^ This is fine until you send this 
stuff to stdout. Either Python doesn't realize that gs is ready OR gs
doesn't send the correct exit code.
> 	      ' -c %(offx)f %(offy)f translate'
> 	      ' /oldshowpage /showpage load def /showpage \'{}\' def '
> 	      ' -f%(filename)s -c oldshowpage quit')
-- deleted -----

> 
> -- 
> Bernhard Herzog	  | Sketch, a drawing program for Unix
> herzog at online.de  | http://www.online.de/home/sketch/
Ciao
	Gregor




More information about the Python-list mailing list