Guest User

Untitled

a guest
Oct 24th, 2013
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. #! /usr/bin/env python
  2.  
  3. import os
  4.  
  5. all_good = True
  6.  
  7. good = 0
  8. bad = 0
  9.  
  10. os.chdir('logs')
  11.  
  12. for fn in os.listdir('.'):
  13.     with open(fn, 'r') as fp:
  14.         content = fp.read().replace('\r', '\n')
  15.  
  16.     try:
  17.         with open(fn, 'w') as fp:
  18.             fp.write(content)
  19.     except:
  20.         print fn, ' is not finished yet'
  21.  
  22.     if 'time=00:00:59.' not in content:
  23.         content = content[:-1]
  24.         print 'error in',  fn, ' : ', content[content.rfind('\n')+1:]
  25.         all_good = False
  26.         bad += 1
  27.     else :
  28.         good += 1
  29.  
  30. print 'Good :', good, ' | Bad :', bad
  31. if all_good: print 'No errors'
Advertisement
Add Comment
Please, Sign In to add comment