Skip to content

Commit

Permalink
prevent accidental file creation
Browse files Browse the repository at this point in the history
  • Loading branch information
slinnarsson committed Sep 29, 2018
1 parent e346803 commit cdded22
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion loompy/loompy.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def __init__(self, filename: str, mode: str = 'r+', *, validate: bool = True, sp
Returns:
Nothing.
"""

if not os.path.exists(filename):
raise IOError(f"File '{filename}' not found")
# make sure a valid mode was passed
if mode != 'r+' and mode != 'r':
raise ValueError("Mode must be either 'r' or 'r+'")
Expand Down

0 comments on commit cdded22

Please sign in to comment.