from pathlib import Path


def read_file_to_list(p4pfile: str) -> list:
    """
    Reads a file and returns a list without line endings.
    """
    p4plist = []
    try:
        p4plist = Path(p4pfile).read_text().splitlines(keepends=False)
    except IOError as e:
        print(e)
        print('*** CANNOT READ FILE {} ***'.format(p4pfile))
    return p4plist