_csv.Error: field larger than field limit (131072) 2019.12.16 Post 155 1 分钟数据库部分翻车, 写了点脚本搞恢复导出脚本大概长这样 1 2 3 4 5 6 7 8 9 10 11 12 13 14 def temp_dump_answer(): """ 导出部分数据 """ def write(data): with gzip.open('dump_answer.csv.gz', 'wt', newline='') as file_obj: writer = csv.writer(file_obj) for key, value in data.items(): writer.writerow([key, json.dumps(value)]) def export(conn): ...我是导出... write(data) 恢复的脚本免不了要read一下这个csv文件1 2 3 4 def restore(): with gzip.open('dump_answer.csv.gz', 'rt', newline='') as file_obj: for qid, ans in csv.reader(file_obj): pass 一顿骚操作, 报错如题, 于是放狗, 解决~1 2 3 # fix "_csv.Error: field larger than field limit (131072)" # via https://stackoverflow.com/a/15063941 csv.field_size_limit(sys.maxsize)