Changeset 689 in tmcsimulator for trunk/src/python/unifiedlogger/cad_watcher.py
- Timestamp:
- 10/02/2022 01:23:27 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/src/python/unifiedlogger/cad_watcher.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/python/unifiedlogger/cad_watcher.py
r687 r689 32 32 except IOError as ex: 33 33 if ex.errno == 2: 34 # 'No such file or directory' 35 # Assumethis is a read sync problem: Don't modify lastLineNum34 # 'No such file or directory' - could be system was restarted or 35 # this is a read sync problem: Don't modify lastLineNum 36 36 print pathToLog + " missing, skipping file read." 37 37 #lastLineNum = 0 #Start over … … 45 45 fileSize = os.path.getsize(pathToLog) 46 46 if fileSize == 0: 47 print pathToLog+" is empty, skipping file read and resetting." 48 lastLineNum = 0 #Start over 47 # Assume this is a read sync problem: Don't modify lastLineNum 48 # because once the file is synced it will have same # of lines. 49 print pathToLog+" is empty, skipping file read." 50 #lastLineNum = 0 #Start over 49 51 return [] 50 52 else: # file is good, read it. … … 52 54 text_file.close() 53 55 currList = [] 56 # If the system restarted there is usually fewer lines in the file 57 # than lastLineNum, so assume all lines are new and reset lastLineNum 58 if len(msgList) < lastLineNum: 59 print pathToLog + " has few lines than expected, assuming restart." 60 lastLineNum = 0 54 61 currList = msgList[lastLineNum:] # new items since last file read 55 62 lastLineNum = len(msgList)
Note: See TracChangeset
for help on using the changeset viewer.
