diff --git a/bin/follow-cvelist.py b/bin/follow-cvelist.py index d87dc81..196177c 100755 --- a/bin/follow-cvelist.py +++ b/bin/follow-cvelist.py @@ -448,17 +448,18 @@ def changed_files(self, current_commit: str, past_commit: str) -> List[bytes]: def json_at_commit(self, path: Path, commit: str) -> Any: """Dictionary of JSON file contents at given commit""" try: + pathstr = path.as_posix() # for Windows compatibility result = subprocess.run( - ["git", "show", f"{commit}:{path}"], stdout=subprocess.PIPE + ["git", "show", f"{commit}:{pathstr}"], stdout=subprocess.PIPE ) data = json.loads(result.stdout.decode("utf-8")) if self.args.verbose > 3: - print(f"[{commit}:{path}] {data}", file=sys.stderr) + print(f"[{commit}:{pathstr}] {data}", file=sys.stderr) return data except IOError: - print(f"Could not open {commit}:{path}", file=sys.stderr) + print(f"Could not open {commit}:{pathstr}", file=sys.stderr) except json.decoder.JSONDecodeError: - print(f"Could not parse {commit}:{path}", file=sys.stderr) + print(f"Could not parse {commit}:{pathstr}", file=sys.stderr) return {} def cvelist_repo(self) -> bool: @@ -471,7 +472,7 @@ def cvelist_repo(self) -> bool: working = Path(os.getcwd()) if os.path.samefile(str(toplevel), str(working)): - readmefile = open("README.md", "r") + readmefile = open("README.md", "r", encoding="utf-8") readme = readmefile.readlines() readmefile.close() for line in readme: