OSError:[Errno 2]没有这样的文件或目录

时间:2012-10-31 08:32:31

标签: python macos python-2.7 subprocess wget

我试着编写一个python脚本来调用终端做一些简单的文本到脚本的东西:

import subprocess

text = "hello+world" #or any other texts
outputFileName = text+".mp3"
source = "\"http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q="+text+"\""

cmd = "wget -q -U Mozilla -O "+outputFileName+" "+source
cmd2 = ["wget", "-q", "-U", "Mozilla", "-O", outputFileName, source]

subprocess.call(cmd, shell=True)
subprocess.call(cmd2)

但是,我从上述两个电话中获得了OSError: [Errno 2] No such file or directory。我已经阅读了文档和其他一些线程,我想我可能错误地解析了wget的参数,但仍然无法解决。

0 个答案:

没有答案