开发者

python ghostscript Popen cannot find file

import ghostscript
import sys, subprocess,os
output = subprocess.Popen(['gs', '-dSAFER', '-dNOPAUSE', '-dBATCH', '-sDEVICE=tiffg4', '-g6120x7920 ','-r720x720','-sOutputFile=C:\Python25\pdfmining\page_%03d.开发者_如何学Gotif' 'C:\Python25\pdfmining\ae.pdf'])

WindowsError: [Error 2] The system cannot find the file specified, with a call to line 3 in the program above. I know i am missing something really simple here, related to Popen i believe, anyone see what is causing this and why I am getting can't find file?


Try the shell=True parameter to Popen. I believe this will involve the shell path for executable programs.


For windows install ghostscript and set the path in enviornment variables and execute the following command.

command = ["gswin32c", "-q",
"-g%dx%d" % size,
"-dNOPAUSE -dSAFER",
"-sDEVICE=ppmraw",
"-sOutputFile=%s" % file ]

command = string.join(command)

gs = os.popen(command, "w")

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜