[Tutor] shelve error

Ron A rha207 at webtv.net
Wed Jan 21 13:43:56 EST 2004


I have Python 2.2 and when I try this program I get a popup with this
message. Can you see what I'm doing wrong? I just want to take some info
I have in a file and (shelve it?). 
PYTHONW caused an invalid page fault in 
module MSVCRT.DLL at 0167:78012473. 
Registers: 
EAX=00000002 CS=0167 EIP=78012473 EFLGS=00010246 
EBX=00750880 SS=016f ESP=0062cdc4 EBP=0062cdcc 
ECX=ffff01f0 DS=016f ESI=00aef68e FS=0f77 
EDX=00000000 ES=016f EDI=00aef70e GS=0000 
Bytes at CS:EIP: 
8a 06 88 07 8a 46 01 c1 e9 02 88 47 01 83 c6 02 
Stack dump: 
0000ff8e 1e03b1d0 0062ce00 00f1812c 00aef70e 00aef68e ffff01f2 00ada1c0
00aef68e 00add470 00aef70e 00adf700 00000008 00000080 1e030200 0062ce48 
This program ass performed an illegal operation and will be shut down. 
### Here's the program ######### 
import cPickle, shelve 
hold = [] 
data = open('inout.txt', 'r') 
while 1: 
    temp = data.readline() 
    if temp == '': 
        break 
    temp = temp[:-1] 
    temp = temp.split('\t') 
    hold.append(temp) 
data.close() 
data = shelve.open('inventory') 
for num in hold: 
    a = num[0] 
    b = num[1] 
    c = num[2] 
    d = num[3] 
    e = num[4] 
    f = num[5] 
    g = num[6] 
    h = num[7] 
    i = num[8] 
    j = num[9] 
    k = num[10] 
    l = num[11] 
    m = num[12] 
    n = num[13] 
    data[b] = [a, c, d, e, f, g, h, i, j, k, l, m, n] 
    data.sync() 
data.close




More information about the Tutor mailing list