[PyQt] QProcess arguments list problem

Mark Summerfield mark at qtrac.eu
Thu Nov 22 05:51:52 GMT 2007

On 2007-11-21, kib2 wrote:
> Hi,
> I'm using QProcess to launch some commands, no problem with basic ones,
> ie to launch a LaTeX file with pdflatex I use:
> self.proc.start("pdflatex", QtCore.QStringList(["my_file.tex"]))
> Now, I wanted to launch the following command :
> "lout my_file.lout > my_file.ps"
> I've made these tries but they all failed :
> 1. self.proc.start("lout",
> QtCore.QStringList(["my_file.lout",">","my_file.ps"]))
> 2. self.proc.start("lout", QtCore.QStringList(["my_file.lout"," >
> ","my_file.ps"]))
> Any idea ?
> Thanks a lot in advance.

I think PyQt is nice enough to accept a Python list here. Also, I don't
think you can use a shell redirection (>) like this, so I'd try:

    self.proc.start("lout", ["-o", "my_file.ps", "my_file.lout"])

If you really wanted to use redirection you'd have to do it yourself,
that is:

    self.proc.start("lout", ["my_file.lout"])
    # Now read the process's stdout and write that to your .ps file.

Off Topic:
In lout (and many other apps) the -o option says write the postscript to
the filename following; do lout -v for a summary of all the options; and
don't use the PDF option, use ghostscript for PDF.

Mark Summerfield, Qtrac Ltd., www.qtrac.eu

More information about the PyQt mailing list