EOFError using cPickle.load

jano jnana4 at DELETEhotmailCAPS.com
Sun Sep 1 16:56:34 EDT 2002


Hi,

I am getting an EOFError when i try to load a cPickled object that was
cPickled in binary format.

>>> import cPickle
>>> cPickle.dump(keywordDict, open('pickle.p', 'w'), 1)
>>> somedict = cPickle.load(open('pickle.p', 'r'))
Traceback (most recent call last):
  File "<pyshell#60>", line 1, in ?
    somedict = cPickle.load(open('pickle.p', 'r'))
EOFError
>>>

It works fine with small test dictionaries, but it doesn't seem to like my
keywordDict dictionary, which is a very long inverted index, an excerpt of
which follows:

{'cellularli': ['4620'], 'non-cooper': ['2350'], 'liar': ['5800', '5800'],
'consider': ['880', '1270', '1690', '3420'], 'founder': ['3420'], 'illustr':
['3180'], 'fly-bottl': ['6090'], 'hatr': ['1200', '3490'], 'instinctu':
['2260'], 'four': ['20', '1640', '1800', '3420', '3700'], 'presupposit':
['4400'], 'sleep': ['2300'], 'phenomenologist': ['3350', '3350', '3420'],
'conclus': ['470', '1830', '2990'], 'follow': ['390', '390', '1070', '2030',
'3700', '3880'], 'children': ['1990', '5030'], 'abid': ['650'], 'skeleton':
['1110'], 'accus': ['3490'], 'incap': ['1060'], 'tu': ['3960'], 'swai':
['1600'], 'articl': ['4230', '4350'], 'self-piti': ['1200'], 'program':
['440'], 'invari': ['1250'], 'ti': ['4530', '5280'], 'hermann': ['3420'],
'smile': ['1070'], 'pride': ['5180'], 'worth': ['1220', '2480', '2490',
'2790', '3010', '4750', '5890'], 'volit': ['1690', '1710'], 'case': ['1270',
'3700'], 'lure': ['3710'], 'meritrend': ['700'], 'everi': ['390', '500',
'610', '820', '840', '1090', '1150', '1190', '1290', '1530', '1620', '1830',
'1830', '2050', '2060', '2400', '2410', '2620', '2630', '2660', '2670',
'2890', '3240', '3320', '3330', '3460', '3670', '3670', '3670', '4110',
'4120', '4160', '4440', '4520', '4520', '4800', '4900'], 'parcel': ['390'],
'physician': ['5670'], 'fals': ['570', '1180'], 'void': ['1020', '1250',
'2560'], 'rise': ['3620', '4000'], 'lurk': ['3610'], 'voic': ['3710'],
'util': ['390'], 'lumin': ['1190'], 'candid': ['2180'], 'mechan': ['300'],
'lowland': ['140'], 'fall': ['0', '1160', '1250', '1740', '3710', '3710',
'3710', '3790'], 'veri': ['450', '1190', '1320', '1490', '1640', '1900',
'2470', '2680', '2680', '2680', '3460', '3490', '3520', '3680', '4590',
'4620', '4670', '4670', '4670', '5470'], 'affect': ['250'], 'puffi':
['250'], 'strang': ['700', '1480', '3160'], 'vast': ['2870'], 'school':
['1360', '1370', '2370'], 'heaven': ['710', '5260'], 'affirm': ['3310',
'3310'], 'previou': ['3330'], 'sand': ['4060'], 'subhuman': ['1270'],
'tereza': ['3700'], 'small': ['330', '3630', '4620'], 'customari': ['2830'],
'everth': ['1380'], 'disabus': ['1020'], 'triumph': ['1470'], 'fritter':
['5560', '5590'], 'enjoy': ['4570'], 'chew': ['270'], 'abil': ['5870',
'6180'], 'direct': ['390', '390', '1780', '4340'], 'dogmat': ['3220'],
'past': ['20', '430', '430', '430', '440', '1270', '1320', '1960', '1960',
'2060', '3330', '3530', '3530'], 'consequ': ['1680', '1830', '2550'],
'second': ['110', '3490', '3700', '3700', '3700', '5140'], 'street': ['800',
'870', '3700'], 'design': ['4430', '4560'], 'pass': ['2890', '3260',
'5140'], 'link': ['3470'], 'illumin': ['3600', '4620'], 'theory': [],
'excit': ['1020', '1210'], 'aim': ['380', '390', '1420', '5110', '6090'],
'hide': ['2700', '3500', '3730', '4340'], 'barrier': ['3750'], 'microphon':
['3620', '3700'], 'solemn': ['250'], 'sun': ['4340', '4340'], 'sum':
['1280']}

It works fine in text mode, but is too slow, so i tried it in binary mode,
but i get the EOFError everytime.

Anybody know what is going on here or how I can get this to work in binary
mode?

thanks,

jano





More information about the Python-list mailing list