2
self.data
is a list (in CSV
):
self.data = [row for row in csv.reader(f)]
self.data = [row for row in csv.reader(file.read().splitlines())]
hence this_file
is a list:
this_file = csv_object.get_data()
So when you do new_object = CSVImport(csvfile=this_file,...)
seems that CSVImport
is expecting csvfile
to be a string but you’re passing it a list
.
I don’t know exactly what you’re trying to accomplish but that seems to be the error.
Hope this helps!
Source:stackexchange.com