2024-09-30 14:35:54 发布
网友
我需要在python中的Popen调用中使用stream redirectiton,以便在wine中使用bat文件。我要做这个:
wine32 cmd < file.bat
当我从终端手动运行它时,它可以工作,但是当我试图从python调用它时:
我得到错误:没有这样的文件或目录
怎么处理呢?在
谢谢
也许你可以检查一下这根线。。https://stackoverflow.com/a/5469427/3445802
from subprocess import Popen p = Popen("batch.bat", cwd=r"C:\Path\to\batchfolder") stdout, stderr = p.communicate()
试试这个:
import sys #... with open('file.bat', 'r') as infile: subprocess.Popen(['wine32', 'cmd'], stdin=infile, stdout=sys.stdout, stderr=sys.stderr)
确保wine32的每个参数都是一个单独的列表元素。在
wine32
也许你可以检查一下这根线。。https://stackoverflow.com/a/5469427/3445802
试试这个:
确保
wine32
的每个参数都是一个单独的列表元素。在相关问题 更多 >
编程相关推荐