csv.field_size_limit(sys.maxsize)

I have an error like this:


csv.field_size_limit(sys.maxsize) 
overflowerror: python int too large to convert to c long

so the solution is modify with this:


# from this
csv.field_size_limit(maxInt)

# to this
maxInt = sys.maxsize
while True:
    try:
        csv.field_size_limit(maxInt)
        break
    except OverflowError:
        print(maxInt)
        maxInt = int(maxInt / 10)

csv.field_size_limit(maxInt)