using os.system and ps2pdf

Mark Hadfield m.hadfield at
Wed Jun 20 20:28:23 EDT 2001

----- Original Message -----
From: "iddwb" <iddwb at>

> import os, sys, tempfile
> if __name__ == '__main__':
>     psf = tempfile.mktemp("psf")
>     pdf = tempfile.mktemp("pdf")
>     ps = open(psf, "w")
>     ps.write(
>     ps.close
>     print "ps2pdf %s %s" % (psf, pdf)
>     os.system("ps2pdf %s %s" % (psf, pdf))





ps.close is a function object. If you type ps.close at the interpreter you
get a string representation of the function, something like

    <function close at 0xa02df2c>

If you include it in a .py file it does nothing.

To *invoke* a function, you need the parentheses.

Been there done that.

Mark Hadfield
m.hadfield at
National Institute for Water and Atmospheric Research

Posted from [] 
via Mailgate.ORG Server - http://www.Mailgate.ORG

More information about the Python-list mailing list