AttributeError: 'list' object has no attribute 'lower'

Hi everyone,

When I try to buy a con on binance with my bot it sometimes gives me this error;

AttributeError: ‘list’ object has no attribute ‘lower’ .

The piece of code that gives me the error is this:

if bal[‘asset’].lower() == asset.lower():

From my understanding python thinks that either bal[‘asset’] is a nested list or asset is one.

Does anyone know how I can fix this error ?

thanks in advance !

First find out which one is sometimes a list and then work backwards from there.

I’d change the code while debugging to something like this to print out the values when the error occurs:

    condition = bal['asset'].lower() == asset.lower():
except AttributeError:
    print("bal['asset'] is", repr(bal['asset']))
    print("asset is", repr(asset))

if condition:

Thanks for your reply, I have it fixed now.
Cheers !