Skip to content

Commit 6142c75

Browse files
committed
fixes reading of toml files
toml read requires BinaryIO instead of the textfile
1 parent 2ec02e5 commit 6142c75

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sbom4python/scanner.py

Lines changed: 3 additions & 3 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:
@@ -740,7 +740,7 @@ def process_uvlock_file(self, filename):
740740
filePath = pathlib.Path(filename)
741741
# Check path exists and is a valid file
742742
if filePath.exists() and filePath.is_file():
743-
with open(filename) as file:
743+
with open(filename, "rb") as file:
744744
uvlock_data = toml.load(file)
745745
if self.debug:
746746
print(uvlock_data)

0 commit comments

Comments
 (0)