Specifications

67
while True:
try:
with open(ObservationFilePath, 'a') as OutFile:
OutFile.writelines(DataLine+'\n')
if not ObservationFilePath in ModifiedFiles:
ModifiedFiles.append(ObservationFilePath)
break
except IOError:
while True:
AbortOrRetry = raw_input('ERROR while opening %s: Abort or
Retry? [A/R]' %ObservationFilePath)
if AbortOrRetry.upper() in ('A', 'R'): break
if AbortOrRetry.upper() == 'A': break
else: #if not diagnostics nor a properly terminated message or known
binary format, then it's garbage and gets dumped here
GarbageFilePath = BaseDir + '\\' + IMEI + '-X.txt'
while True:
try:
with open(GarbageFilePath, 'a') as OutFile:
OutFile.writelines(DataLine+'\n')
break
except IOError:
while True:
AbortOrRetry = raw_input('ERROR while opening %s: Abort or
Retry? [A/R]' %GarbageFilePath)
if AbortOrRetry.upper() in ('A', 'R'): break
if AbortOrRetry.upper() == 'A': break
#the -X.txt garbage files are not sorted since we don't know what is in
them
SeenMessageHashes.append(DataLineHash)
AppendedLines += 1
if IsSummer: AppendedSummer += 1
if IsWinter: AppendedWinter += 1
if IsWithInstant: AppendedWithInstant += 1
if IsDiagnostics: AppendedDiagnostics += 1
if IsMalformed: ApendedMalformed += 1
else:
if DataLineHash in SeenMessageHashesPreviousRuns:
SkippedAlreadyParsed += 1
print ' NOTE - Message has already been parsed: skipping'
else:#note this is not 100% accurate: on subsequent runs, repeated are just
detected as duplicated
SkippedDuplicated += 1
print ' NOTE - Message was sent more than once (an Iridium or NAL
bug): skipping'
#see emails in March 2008 with NAL engineers recognizing the issue