joalla / discogs_client

Continuation of the "Official Python Client for the Discogs API"
https://python3-discogs-client.readthedocs.io
Other
310 stars 50 forks source link

python3 cant view contents of <list> #112

Closed MartinBarker closed 2 years ago

MartinBarker commented 2 years ago

I am using a python discogs api package to retrieve a music playlist from online. I need to iterate through this list to view all results, but no matter what I try I get a typeerror saying 'list object is not iterable / subscriptable'

d = discogs_client.Client('ExampleApplication/0.1', user_token=DISCOGS_TOKEN)
results = d.list('117796')
print('results=')
print(results)
print(results[0])

you can see I am returning a list just fine, but if I try to view the contents of said list, I get an error

results=
<List '117796' 'Ron Hardy @ Music Box'>
Traceback (most recent call last):
  File "twitter_bot.py", line 52, in <module>
    artist = results[0].artists[0]
TypeError: 'List' object is not subscriptable
prcutler commented 2 years ago

Closing - duplicate of #111