python - Smartsheet Data Tracker: AttributeError: 'dict' object has no attribute 'append' -
i new python , i'm working smartsheet data tracker update sheet csv file.
i have problems array list management in python; don't know error, reading error on stackoverflow don't understand it:
the error:
"file "c:\users\david\datatraker\connectors\csvcon.py", line 61, in __init__ self.csvdata.append(readerrow) attributeerror: 'dict' object has no attribute 'append'"
and code:
def __init__(self, sourceconfig): self.csvdata = [] self.csvdata = {"sourceid": "siniestros", "connectorclassname": "csvcon", "filename": "siniestros.csv", "isstrict": false} readerrow in sourcereader: self.csvdata.append(readerrow)
what going wrong create list
append
later. overwrite afterwards dictionary, cannot append. why attributeerror
.
to fix this, rename dictionary (self.csvdata={stuff}
) created after list
else such self.meta
, perhaps. alternatively, rename list
.
it doesn't matter which, need remove naming conflict both variables can co-exist in namespace.
Comments
Post a Comment