The NAME field doesn't need to fit that many characters, The Pg_Number field needs to be long, I've adjusted it to its maximum size (which is apparently only 254 characters?) However, one of the NAME fields has 74 different page numbers plus the ", " so its maximum size should be set to 370The code results in the same error, the full code I'm running is:
import os
import arcpy
table = r"c:\users\craig.mcdade\GridforPython.dbf" # source_table
new_table = r"table.dbf" # new table name + extension only
tempTable = r"\\in_memory\temp_table"
outPath = r"c:\users\craig.mcdade" # path to output location on disk
keyField = 'NAME'
valField = 'Pg_Number'
tableDict = {}
arcpy.MakeTableView_management(table, tempTable)
with arcpy.da.SearchCursor(tempTable, [keyField, valField]) as cursor:
for row in cursor:
tableDict.setdefault(row[0], []).append(row[1])
insertCursor = arcpy.da.InsertCursor(os.path.join(outPath, new_table), [keyField, valField])
for key, val in tableDict.iteritems():
insertCursor.insertRow((key, ', '.join(str(item) for item in val)))