Error: csv.Error: field larger than field limit (131072)

1

I have a program that opens csv files, operates with phrases and records data in another csv file.

I am now getting an error that I had never obtained before. I have searched the Internet for solutions but I can not find much.

The error is as follows:

Traceback (most recent call last):
  File "C:/Users/file.py", line 222, in <module>
    sents, tagged_sents = tag_read_sentences()
  File "C:/Users/file.py", line 130, in wrapper
    value = func(*args, **kwargs)
  File "C:/Users/file.py", line 201, in tag_read_sentences
    sents = read_input_sentences()
  File "C:/Users/file.py", line 148, in read_input_sentences
    for row_i, row in enumerate(reader):
  File "C:\Python36-32\lib\csv.py", line 111, in __next__
    self.fieldnames
  File "C:\Python36-32\lib\csv.py", line 98, in fieldnames
    self._fieldnames = next(self.reader)
_csv.Error: field larger than field limit (131072)

I appreciate the help, as always. I cross my fingers.

    
asked by pyring 07.11.2017 в 16:14
source

1 answer

1

The problem is that the size of the fields of a csv has a limit by default, which you can eventually consult and / or configure using field_size_limit . You can extend this limit for example in the following way:

import csv

csv.field_size_limit(300000)
    
answered by 07.11.2017 / 16:41
source