Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wolski committed Jan 17, 2025
1 parent d822f61 commit 8c5cfd7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions proteobench/io/params/peaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,11 @@ def read_peaks_settings(file_path: str) -> ProteoBenchParameters:
# Try to read the file contents

try:
with open(file_path) as f:
# Attempt to open and read the file
with open(file_path, encoding="utf-8") as f:
lines = f.readlines()
except:
lines = [l for l in file_path.read().decode("utf-8").splitlines()]
except Exception as e:
raise IOError(f"Failed to open or read the file at {file_path}. Error: {e}")

# Remove any trailing newline characters from each line
lines = [line.strip() for line in lines]
Expand Down
7 changes: 4 additions & 3 deletions proteobench/io/params/spectronaut.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ def read_spectronaut_settings(file_path: str) -> ProteoBenchParameters:
"""
# Try to read the file contents
try:
with open(file_path) as f:
# Attempt to open and read the file
with open(file_path, encoding="utf-8") as f:
lines = f.readlines()
except:
lines = [l for l in file_path.read().decode("utf-8").splitlines()]
except Exception as e:
raise IOError(f"Failed to open or read the file at {file_path}. Error: {e}")

# Remove any trailing newline characters from each line
lines = [line.strip() for line in lines]
Expand Down

0 comments on commit 8c5cfd7

Please sign in to comment.