cmd - ImageMagick Conversion from .ps to .png, run from python - invalid param -
i have been looking through similar posts , through imagemagick page, cannot seem find reason issue:
note using windows machine.
i have .ps image in folder , works when running command convert cmd: convert saved.ps newsaved.png
however when try execute python script following code:
args = ["convert","saved.ps newsave.png"] subprocess.popen(args) #or call(args) os.system("start newsave.png")
the cmd window says newsave.png invalid parameter. (the error message being: invalid parameter - newsave.png
in cmd window, closes instantly)
having seperated comma in args
has not helped. os.getcwd()
returns current work directory well, know i'm in right dir. error happens when subprocess called.
make each command-line argument separate element of args
. also, use subprocess.call
ensure convert
function has completed before call os.system("start newsave.png")
:
args = ["convert", "saved.ps", "newsave.png"] rc = subprocess.call(args) if rc != 0: print "rc =", rc
Comments
Post a Comment