def get_filename(filename):
    """
    Gets the filename from a filename~ext combination. Throws a ValueError
    if there seems to be no filename.

    Keyword arguments:
        filename -- the file to get the base filename from
    """
    try:
        result = filename[:filename.index('~')]
    except __HOLE__:
        result = filename

    if len(result) == 0:
        raise ValueError('Filename of "{}" is nothing'.format(filename))

    return result
dataset/ETHPy150Open gosquadron/squadron/squadron/exthandlers/extutils.py/get_filename