[Tutor] Newbie problem with TypeError
Jonathan Soons
jsoons at juilliard.edu
Mon Nov 17 11:32:10 EST 2003
I am completely baffled by this TypeError.
The program is 617 lines so I am just showing the relevant part.
Please help.
def newpage(words) :
PDF_end_page(pdf)
PDF_begin_page(pdf, WIDTH, HEIGHT)
PDF_setfont(pdf, font0, 14)
PDF_set_text_pos(pdf, INCH, 704)
PDF_show(pdf, last + ", " + first)
PDF_set_text_pos(pdf, INCH, 690)
mklines(words)
def mklines(field) :
if len(field) < 4 :
return
words = field.split(" ")
while len(words) > 1 :
line = ""
list(words) #definitely a list
while (len(line) < 60) and len(words) > 1 :
line = line + " " + words[0]
if len(words) > 0 :
del(words[0])
PDF_continue_text(pdf, line)
if PDF_get_value(pdf, "texty", 0) < INCH :
words = string.joinfields(words, " ")
str(words) #newpage() requires string argument
newpage(words)
if len(words) == 1 :
PDF_continue_text(pdf, " " + words[0])
Traceback (most recent call last):
File "./parseapps.py", line 174, in ?
mklines(essay)
File "./parseapps.py", line 50, in mklines
del(words[0])
TypeError: object doesn't support item deletion
More information about the Tutor
mailing list