[Tutor] IDLE Crashing

Adam Gomaa ag at adamgomaa.com
Fri Aug 4 19:05:46 CEST 2006


I'm having trouble with this script. When I run it, it crashes IDLE... 
which is no fun. :(

I'm running Ubuntu 6.06 w/ python 2.4

When I say crash, I mean really _crash_. IDLE stop responding, and I 
have to killall idle && killall python2.4 before I can restart it (cause 
python2.4 keeps the TCP port open, I'm assuming)

A few notes:
list.txt is a text file with 99 lines, each with three letters on it.
In ./retrieves, I have 99 files of style [xyz].1.txt. (in addition to 
list.txt) These are retrieved HTML pages that have the HTML stripped 
(the actual script is part of a series of scripts to download and format 
my school's course catalog)
It seems to crash on the final iteration of the second for loop, no 
matter what file it's on at that point (which I've changed by changing 
x&y in 'for each in filelist[x:y]:' to diffrent values), so I don't 
think it has anything to do with the actual files it's accessing.

-----
#2006 Adam Gomaa, Public Domain
listfiles=open('retrieves/list.txt','r')
fileread=listfiles.read() ##reads list.txt and assings to fileread
filelist=[]
filelist=fileread.splitlines() ##each filelist word is 3-letter combo
listfiles.close()
count,count2=0,0 ##for debugging
textstringlist=[]
goodlist1=[]
for each in filelist[:-50]: ##filelist[x:y] always crashes for any value 
of x,y
    print count ##for debugging
    count=count+1
    textfileread=open('retrieves/%s.1.txt' % each,'r')
    textstring=textfileread.read()
    textfileread.close()
    each=each.upper()
    textstringlist=textstring.split(each)##if I comment out from here...
    for each2 in textstringlist[:]: #changing to textstringlist[3:-3] 
still results in crash
        count2=count2+1
        print count2,'is count2' ##this gets quite high, into thousands, 
before stopping on the final iteration (and crashing)
        if 'Prerequisites' in each2:
            goodlist1.append(each2)##to here, it doesn't crash
print goodlist1
------

Anyone have an insight?
If someone would like me to I can tar the 99 files & list.txt and post a 
link.
Thanks,


More information about the Tutor mailing list