Skip to main content
 首页 » 编程设计

Python 脚本 : gives no such file or directory

2025年05月04日13freeliver54

<分区>

我正在尝试使用 wolframalpha api 搜索查询,我已经使 python 脚本可执行。

chmod +x qp.py 

并运行它

./qp.py 

然后我得到一个错误

:No such file or directory

这是我的脚本

#!/usr/bin/env python 
 
import wolframalpha 
import sys 
app_id='KYPE8J-6PY3KHRRUA' 
client = wolframalpha.Client(app_id) 
query = ' '.join(sys.argv[1:]) 
res = client.query(query) 
if len(res.pods) > 0: 
    texts = " " 
    pod = res.pods[1] 
    if pod.text: 
        texts = pod.text 
    else: 
        texts = "I have no answer for that" 
        texts = texts.encode('ascii', 'ignore') 
        print texts 
else: 
    print "Sorry, I am not sure."