3xhile
(Gerald Tiel)
1
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 !
MRAB
(Matthew Barnett)
2
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:
try:
condition = bal['asset'].lower() == asset.lower():
except AttributeError:
print("bal['asset'] is", repr(bal['asset']))
print("asset is", repr(asset))
raise
if condition:
2 Likes
3xhile
(Gerald Tiel)
3
Thanks for your reply, I have it fixed now.
Cheers !