从windows运行Python中的GhostScript命令

2024-10-01 00:23:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个GhostScript命令(windows命令提示符),我想从Python执行它。 我可以成功运行:

os.system(gswin64c.exe -sDEVICE=tiff24nc -r300 -o fullfilename.tiff fullfilename)

但我有个错误:

os.system(gswin64c.exe -sDEVICE=tiff24nc -r300 -o fullfilename.tiff -g235x49 -c "<</Install {-478 -743 translate}>> setpagedevice" -f fullfilename)

而这个命令在命令提示符下运行良好。 我把范围缩小到这个问题:

-c "<</Install {-478 -743 translate}>> setpagedevice"

似乎有些字符是由python而不是GhostScript解释的。 如果我打印命令,它返回1。所以有一个错误。 不知道如何严格地将整个命令传递给windows命令提示符。
谢谢
哈波


Tags: install命令oswindows错误exesystem命令提示符