using os.system and ps2pdf
Mark Hadfield
m.hadfield at niwa.cri.nz
Wed Jun 20 20:28:23 EDT 2001
----- Original Message -----
From: "iddwb" <iddwb at imap1.asu.edu>
> import os, sys, tempfile
>
> if __name__ == '__main__':
> psf = tempfile.mktemp("psf")
> pdf = tempfile.mktemp("pdf")
> ps = open(psf, "w")
> ps.write(sys.stdin.read())
> ps.close
> print "ps2pdf %s %s" % (psf, pdf)
> os.system("ps2pdf %s %s" % (psf, pdf))
Replace
ps.close
with
ps.close()
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 niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research
--
Posted from clam.niwa.cri.nz [202.36.29.1]
via Mailgate.ORG Server - http://www.Mailgate.ORG
More information about the Python-list
mailing list