Hi there,
i want to use an long int from an list which i got from my function
find_lineno().
But i got this error and i don't understand why i can not use this long
as an argument.
Where do i find a good documentation on errors so that i complete
understand what
the heck is going on.
Many thanks.
ERROR:
---------------------------------------------------
Traceback (most recent call last):
File "./extrmails.py", line 42, in ?
inputfile.seek(0,li)
IOError: [Errno 22] Invalid argument
---------------------------------------------------
CODE-START:
-----------------------------------------------------------------------------
inputfile=open("mails","rt")
# --------------------------------------------------------------------------
def reset_inputfile():
inputfile.seek(0,0)
# --------------------------------------------------------------------------
def find_lineno(string):
f = -1
a = "start"
found_lines = []
reset_inputfile()
while len(a) != 0:
a = inputfile.readline()
f = a.find(string)
if f != -1:
found_lines.append(inputfile.tell())
return found_lines
# --------------------------------------------------------------------------
from_lineno=find_lineno("From:")
subj_lineno=find_lineno("Subject:")
print len(subj_lineno)
print len(from_lineno)
reset_inputfile()
for li in subj_lineno:
inputfile.seek(0,li) <------ ???????
.......
......
--------------------------------------------------------------------------
CODE-END
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor