Show
Ignore:
Timestamp:
11/17/07 16:21:11 (16 years ago)
Author:
jerome
Message:

Improved code robustness.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/pkpgpdls/hbp.py

    r480 r489  
    6161        pos = 0 
    6262        try : 
    63             while True : 
    64                 if (minfile[pos] == "@") \ 
    65                    and (minfile[pos:pos+fflen] == formfeed) : 
    66                     pagecount += 1 
    67                     pos += fflen 
    68                 else :         
    69                     pos += 1 
    70         except IndexError : # EOF ? 
    71             pass 
    72         minfile.close() # reached EOF 
     63            try : 
     64                while True : 
     65                    if (minfile[pos] == "@") \ 
     66                       and (minfile[pos:pos+fflen] == formfeed) : 
     67                        pagecount += 1 
     68                        pos += fflen 
     69                    else :         
     70                        pos += 1 
     71            except IndexError : # EOF ? 
     72                pass 
     73        finally :         
     74            minfile.close() # reached EOF 
    7375        return pagecount 
    7476