Skip to content

Commit

Permalink
Ensure XML files are opened with UTF-8 encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwthompson committed Aug 22, 2024
1 parent 3bb4063 commit 2207d29
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion foyer/forcefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def preprocess_forcefield_files(forcefield_files=None):

for xml_file in forcefield_files:
if not hasattr(xml_file, "read"):
f = open(xml_file)
f = open(xml_file, encoding="utf-8")

Check warning

Code scanning / CodeQL

File is not always closed Warning

File may not be closed if an exception is raised.
_, suffix = os.path.split(xml_file)
else:
f = xml_file
Expand Down

0 comments on commit 2207d29

Please sign in to comment.