EOFError not getting raised

David Bear David.Bear at asu.edu
Fri Jun 10 02:49:51 EDT 2005


I have been trying to do something like this:

f = open('someDocs.str', 'r')
try:
    while True:
        ln = f.readline()
except EOFError:
    print 'reached eof'
    f.close()
    sys.exit(1)


However, EOFError is never raised. What am I missing? 



More information about the Python-list mailing list