I can almost get wolframalpha to run, however I am stuck on this error: i am working on this since 2 days and now everything is working but this error coming
texts = texts.encode('ascii’, ‘ignore')
LookupError: unknown encoding: ascii’, ‘ignore
my code is
#!/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')
please help
Your quote characters are not matching, you are using two different type of quotes ’
and '
.
texts = texts.encode('ascii', 'ignore')