def read_batchfile(pythonpath, file_ending='.py'):

    # open the file
    abspaths = []
    for basepath in settings.BASE_BATCHPROCESS_PATHS:
        # note that pypath_to_realpath has already checked the file for existence
        if basepath.startswith("evennia"):
            basepath = basepath.split("evennia", 1)[-1]
        abspaths.extend(utils.pypath_to_realpath("%s.%s" % (basepath, pythonpath), file_ending))
    if not abspaths:
        raise IOError
    text = None
    decoderr = []
    for abspath in abspaths:
        # try different paths, until we get a match
        # we read the file directly into unicode.
        for file_encoding in ENCODINGS:
            # try different encodings, in order
            try:
                with codecs.open(abspath, 'r', encoding=file_encoding) as fobj:
                    text = fobj.read()
            except (ValueError, UnicodeDecodeError) as e:
                # this means an encoding error; try another encoding
                decoderr.append(str(e))
                continue
            break
    if not text and decoderr:
        raise UnicodeDecodeError("\n".join(decoderr))

    return text


#------------------------------------------------------------
#
# Batch-command processor
#
#------------------------------------------------------------
This reads the contents of a batch-file.  Filename is considered
dataset/ETHPy150Open evennia/evennia/evennia/utils/batchprocessors.py/read_batchfile