jaraco / wolframalpha

MIT License
148 stars 26 forks source link

KeyError @results #16

Closed lenisko closed 3 years ago

lenisko commented 5 years ago

Any clue why it's happening? there's like.. 1/20 chance to hit this error, but still it's annoying.

KeyError: '@results'
  File "wolframalpha/__init__.py", line 88, in __getattr__
    val = self[name] if name in self else self[attr_name]

query on which I hit this error 5800000 JPY in pln

jaraco commented 5 years ago

I don't know, but it sounds like neither name nor attr_name is in self. I'd try debugging further by catching that exception and inspecting the context that leads to the behavior. If I had to guess, I'm guessing the API is throttling or otherwise returning an error response. If that is the case, it would be nice if the API provided a better error message.

lenisko commented 5 years ago

Sorry I won't be able to help anymore. Switched to direct API call in my own project and no issues so far. I will leave it open though, maybe someone else find some time to debug this module.

Luca-Tera commented 3 years ago

I had the same error so I went from answer = (next(res.results).text) to answer = next(res.results).text and it seemed to work perfectly. I dont know why removing the parenthesis worked this is my second day doing this stuff but hope this helps. 👍

jaraco commented 3 years ago

Sounds like the usage recommended in the docs also helps here. I welcome improvements to the project, but this report is inactionable as described.