开发者

python ghostscript Popen cannot find file

开发者 https://www.devze.com 2023-03-13 02:49 出处:网络
import ghostscript import sys, subprocess,os output = subprocess.Popen([\'gs\', \'-dSAFER\', \'-dNOPAUSE\', \'-dBATCH\', \'-sDEVICE=tiffg4\', \'-g6120x7920 \',\'-r720x720\',\'-sOutputFile=C:\\Python25
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

精彩评论

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

关注公众号