Postscript to pdf

Nobody nobody at nowhere.invalid
Mon Sep 21 08:56:29 EDT 2015


On Sun, 20 Sep 2015 23:11:20 +0200, Baladjy KICHENASSAMY wrote:

> i tried this
> 
> def save():
>      Canevas.update()
>      Canevas.postscript(file=tkFileDialog.asksaveasfilename(),
> colormode='color')
>      subprocess.call(["ps2pdf", "-dEPSCrop", "test.ps", "test.pdf"])
> 
> 
> i got the ps file but i didn't get the pdf file :/

Check that subprocess.call() returns zero, or use subprocess.check_output()
instead. Also, if this is a GUI program and you have no easy way to check
what is written to stdout or stderr, try:

    p = subprocess.Popen(["ps2pdf", "-dEPSCrop", "test.ps", "test.pdf"],
                         stderr=subprocess.PIPE)
    out, err = p.communicate()
    if p.returncode != 0:
        raise RuntimeError(err)




More information about the Python-list mailing list