Richard Penman
Working with large CSV files

02 May 2011

When working with large CSV files in Python I sometimes get this:

> Traceback (most recent call last):  
File "stats.py", line 12, in   
for i, row in enumerate(csv.reader(open(filename))):  
_csv.Error: field larger than field limit (131072)

This means the CSV file contains more content between delimiters that allowed by default. To raise this limit use:

import sys  
import csv  
csv.field_size_limit(sys.maxint)
blog comments powered by Disqus