Reputation: 7
my_trends = api.GetTrendsWoeid(my_woe_id)
trends = json.loads(my_trends)
but I get error : raise
TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not list
. I am using python 3.7. and python-twitter. What I am doing wrong?
Upvotes: 0
Views: 24
Reputation: 51683
Debugging such errors is part of the fun - how to do it?
First step: use python to inspect the thing that makes problems:
print(type(my_trends)) # will tell you it is a list
print(*my_trends) # prints all list elements wich tells you what they are
then look into the API for what you are using: twitter.api.Api.GetTrendsWoeid which would tell you, that:
which fully explains why you get
TypeError: the JSON object must be str, bytes or bytearray, not list.
Upvotes: 0