コード例 #1
0
ファイル: cccc.py プロジェクト: theJollySin/armi
 def __exit__(self, exc_type, exc_value, traceback):
     if exc_type is not None:
         return
     try:
         self.close()
     except Exception as ee:
         runLog.error("Failed to close CCCC record.")
         runLog.error(ee)
         raise exceptions.CcccRecordError(
             "Failed to close record, {}.\n{}\n"
             "It is possible too much data was read from the "
             "record, and the end of the stream was reached.\n"
             "".format(self, ee))
コード例 #2
0
ファイル: cccc.py プロジェクト: crisobg1/Framework
 def close(self):
     """Closes the record by reading the number of bytes from then end of the record, if it
     does not match the initial value, an exception will be raised.
     """
     if not self._hasRecordBoundaries:
         return
     # now read end of record
     numBytes2 = self.rwInt(None)
     self.byteCount -= 4
     if numBytes2 != self.numBytes:
         raise exceptions.CcccRecordError(
             "Number of bytes specified at end the of record, {}, "
             "does not match the originally specified number, {}.\n"
             "Read {} bytes.".format(numBytes2, self.numBytes,
                                     self.byteCount))
コード例 #3
0
ファイル: cccc.py プロジェクト: crisobg1/Framework
 def __exit__(self, exc_type, exc_value, traceback):
     if exc_type is not None:
         return
     try:
         self.close()
     except Exception as ee:
         runLog.error("Failed to close CCCC record.")
         runLog.error(ee)
         raise exceptions.CcccRecordError(
             "Failed to close record, {}.\n{}\n"
             "It is possible too much data was read from the "
             "record, and the end of the stream was reached.\n"
             "Check stdout for the file name; you may need to "
             "remove any files in the current directory matching "
             "the pattern ISO*.".format(self, ee))