Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

44 OpenVariant Bug breaks when input has empty lines #45

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions openvariant/variant/variant.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import ctypes
import gzip
import lzma
import warnings
from fnmatch import fnmatch
from functools import lru_cache
import mmap
Expand Down Expand Up @@ -242,8 +243,15 @@ def _parser(self, file_path: str, annotation: Annotation, group_by: str, display

if row and not _exclude(line_dict, annotation.excludes):
yield row

except (ValueError, IndexError, KeyError) as e:
except IndexError as e:
if line == ['']:
warnings.warn(f"Warning: empty line {lnum} on {file_path}.", UserWarning)
pass
else:
self.mm.close()
self.file.close()
raise ValueError(f"Error parsing line: {lnum} {file_path}: {e}")
except (ValueError, KeyError) as e:
self.mm.close()
self.file.close()
raise ValueError(f"Error parsing line: {lnum} {file_path}: {e}")
Expand Down