jaraco / wolframalpha

MIT License
148 stars 25 forks source link

Error with sub.text #20

Closed ghost closed 3 years ago

ghost commented 4 years ago

When I try:

for pod in res.pods:
            for sub in pod.subpods:
                print(sub.text)

It returns an error:

Traceback (most recent call last):
  File "main.py", line 36, in <module>
    provider_wolframalpha(args.item)
  File "main.py", line 28, in provider_wolframalpha
    print(sub.text)
  File "/Users/hari/venv/knowledgeHUB/lib/python3.7/site-packages/wolframalpha/__init__.py", line 88, in __getattr__
    raise AttributeError(name)
AttributeError: text

Please help!!!

Thierryonre commented 4 years ago

The attribute seems to have changed and is now "plaintext" instead of "text".

So use: for pod in res.pods: for sub in pod.subpods: print(sub.plaintext)

Instead of: for pod in res.pods: for sub in pod.subpods: print(sub.text)

jaraco commented 3 years ago

Per #21, it's sub.plainText.

jaraco commented 3 years ago

And the fix contributed there is slated to be released with 4.1.