def read_batchfile(pythonpath, file_ending='.py'):
 abspaths = utils.pypath_to_realpath(pythonpath, file_ending, settings.BASE_BATCHPROCESS_PATHS)
 if (not abspaths):
  raise IOError
 text = None
 decoderr = []
 for abspath in abspaths:
  for file_encoding in _ENCODINGS:
   try:
    with codecs.open(abspath, 'r', encoding=file_encoding) as fobj:
     text = fobj.read()
   except (ValueError, UnicodeDecodeError) as e:
    decoderr.append(str(e))
    continue
   break
 if ((not text) and decoderr):
  raise UnicodeDecodeError('\n'.join(decoderr))
 return text

def read_batchfile ( pythonpath , file_ending = '.py' ) : abspaths = utils . pypath_to_realpath ( pythonpath , file_ending , settings . BASE_BATCHPROCESS_PATHS ) if ( not abspaths ) : raise IOError text = None decoderr = [ ] for abspath in abspaths : for file_encoding in _ENCODINGS : try : with codecs . open ( abspath , 'r' , encoding = file_encoding ) as fobj : text = fobj . read ( ) except ( ValueError , UnicodeDecodeError ) as e : decoderr . append ( str ( e ) ) continue break if ( ( not text ) and decoderr ) : raise UnicodeDecodeError ( '\n' . join ( decoderr ) ) return text
this reads the contents of a batch-file .