I’m getting a strange error when I perform a isinstance call on an object in one of my functions:
def subtotals_to_decimal_string(obj):
"""
Converts subtotals to decimal strings
"""
if isinstance(obj, list):
for cr in obj:
sub = cr['subtotal']
cr['subtotal'] = Decimal(str(sub)).quantize(Decimal('0.01')).to_eng_string()
return obj
The error I’m getting is similar to the one from this post: http://bit.ly/MmkObr
The strange part is that I was able to execute this call in a separate python file. What’s going on?
Thanks in advance!
Most probably, you have a global variable named
list, which is shadowing the built-in namelist. Don’t use names of built-in classes as variable names (or even better, no built-in names at all).