def OpenFileForRead(path, logtext):
 frame = None
 file = None
 if (not path):
  return (frame, file)
 try:
  if path.endswith('.gz'):
   frame = open(path, 'rb')
   file = gzip.GzipFile(fileobj=frame, mode='rt')
  else:
   file = open(path, 'rt')
  if logtext:
   output.Log(('Opened %s file: %s' % (logtext, path)), 1)
  else:
   output.Log(('Opened file: %s' % path), 1)
 except IOError:
  output.Error(('Can not open file: %s' % path))
 return (frame, file)

def OpenFileForRead ( path , logtext ) : frame = None file = None if ( not path ) : return ( frame , file ) try : if path . endswith ( '.gz' ) : frame = open ( path , 'rb' ) file = gzip . GzipFile ( fileobj = frame , mode = 'rt' ) else : file = open ( path , 'rt' ) if logtext : output . Log ( ( 'Opened %s file: %s' % ( logtext , path ) ) , 1 ) else : output . Log ( ( 'Opened file: %s' % path ) , 1 ) except IOError : output . Error ( ( 'Can not open file: %s' % path ) ) return ( frame , file )
opens a text file .