I wrote a twitter client which writes the statuses into a ScrolledText widget, but it rarely gives a error that I can't nail down. The code is:
twitwin.scrolled.config(state=NORMAL) twitwin.scrolled.delete("1.0", END) evens = True _.links = [] for x in _.parser.tweets: start = _.scrolled.index(INSERT) print "start = ",start _.scrolled.insert(END, x['screen_name']+" ", ("bold",)) txt = _.whitere.sub(" ",x['text']) #the text with whitespace compressed islink = False for y in _.urlre.split(txt): #handle urls if y != "": if islink: a = _.scrolled.index(INSERT) _.scrolled.insert(END, y)#, ("link",)) b = _.scrolled.index(INSERT) _.scrolled.tag_add("link", a, b) _.scrolled.tag_add("href%d"%len(_.links), a, b) _.links.append((a,b,y)) #save url info and position in the widget else: _.scrolled.insert(END, y) islink = not islink _.scrolled.insert(END, "\n") if evens: _.scrolled.tag_add("light", start, END) #alternating background colors else: _.scrolled.tag_add("dark", start, END) evens = not evens twitwin.scrolled.config(state=DISABLED) The print statement usually prints a valid index, but rarely prints "start=None" and it crashes. Should I be using something other than INSERT or another method here? Thanks in advance, -- Rick -- http://mail.python.org/mailman/listinfo/python-list