Skip to content

Commit 09bcb07

Browse files
Merge pull request #40 from HalaAli198/fix-toml-binary-mode (fixes #39)
Fix: Open TOML files in binary mode as required by tomllib
2 parents 2ec02e5 + 87ea23a commit 09bcb07

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sbom4python/scanner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ def process_pyproject(self, filename):
647647
filePath = pathlib.Path(filename)
648648
# Check path exists and is a valid file
649649
if filePath.exists() and filePath.is_file():
650-
with open(filename) as file:
650+
with open(filename, "rb") as file:
651651
pyproject_data = toml.load(file)
652652
if "project" in pyproject_data:
653653
if "dependencies" in pyproject_data["project"]:
@@ -713,7 +713,7 @@ def process_pylock(self, filename):
713713
filePath = pathlib.Path(filename)
714714
# Check path exists and is a valid file
715715
if filePath.exists() and filePath.is_file():
716-
with open(filename) as file:
716+
with open(filename, "rb") as file:
717717
pylock_data = toml.load(file)
718718
if "lock-version" in pylock_data:
719719
if self.debug:

0 commit comments

Comments
 (0)