get LookupError: unknown encoding: ascii

get LookupError: unknown encoding: ascii

我几乎可以将 wolframalpha 转换为 运行,但是我被这个错误困住了: 我从 2 天开始就在做这个,现在一切正常,但是这个错误来了

    texts = texts.encode('ascii’, ‘ignore')
LookupError: unknown encoding: ascii’, ‘ignore

我的密码是

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import wolframalpha
import sys


app_id='PR5756-H3EP749GGH'                                              

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"
# to skip ascii character in case of error
texts = texts.encode('ascii’, ‘ignore')
print ('texts')

请帮忙

您的引号字符不匹配,您使用了两种不同类型的引号 '

texts = texts.encode('ascii', 'ignore')