No attr named query
Okay so I'm programming a Wolfram Alpha API and I added a res string with query and its giving me this error: AttributeError: 'str' object has no attribute 'query'
Here's the PyDa.py:
import PySimpleGUI as sg
sg.theme('Dark Blue')
app_id = ('API_key')
client = (app_id)
layout = [ [sg.Text("Hello, my name's Ted. What's your question?")],
[sg.Input()],
[sg.Button('Ok'), sg.Button('Cancel')] ]
window = sg.Window('Ted', layout)
while True:
event, values = window.read()
if event in (None, 'Cancel'):
break
res = client.query(values[0])
print(next(res.results).text)
window.close()
where values[0] is what the user enters. I've tried completely deleting query and it doesn't work. I thing I need to install something but when I try pip install wolframalpha api
it does install but that's not whats missing/ is wrong. I should be getting pods but its not sending those because of the error.
Hmm, I don't know exactly what happens before the client.query
call, but the AtrributeError says client
is of type str. I don't think there is a problem with dependencies, because then the error would be different. The client is according to the docs defined with client = Client(getfixture('API_key'))
. If you have this in your code, then I have no idea what's wrong.