wolframalpha api syntax error

288 views Asked by At

i am working on 'wolframalpha' api and i am keep getting this error, i tried to search but not getting any working post on this error if you know please help me to fix this error

  File "jal.py", line 9
    app_id=’PR5756-H3EP749GGH'
           ^
SyntaxError: invalid syntax

please help; i have to show project tomorrow :(

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
else:
print “Sorry, I am not sure.”
1

There are 1 answers

0
Sebastian On BEST ANSWER

You used a backtick (´) instead of a single-quote (').

app_id='PR5756-H3EP749GGH'

Python directly shows you the error. Also, use an editor with text highlighting.