with open(file_path, 'r') as f:
    lines = (line for line in f if line.strip())
data = pd.read_fwf(FileLike(lines), widths=widths, names=names, comment='#')
How to skip blank lines with read_fwf in pandas?