Skip to content

Commit 24aec11

Browse files
XianBWBowen Xian (Shanghai Wicresoft Co Ltd)
andauthored
fix problem of reading log file tags on Windows (#437)
Co-authored-by: Bowen Xian (Shanghai Wicresoft Co Ltd) <[email protected]>
1 parent b82e597 commit 24aec11

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

rdagent/log/storage.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ def log(
6868
def iter_msg(self, watch: bool = False) -> Generator[Message, None, None]:
6969
msg_l = []
7070
for file in self.path.glob("**/*.log"):
71-
tag = ".".join(str(file.relative_to(self.path)).replace("/", ".").split(".")[:-3])
71+
tag = ".".join(file.relative_to(self.path).as_posix().replace("/", ".").split(".")[:-3])
7272
pid = file.parent.name
7373

74-
with file.open("r") as f:
74+
with file.open("r", encoding="utf-8") as f:
7575
content = f.read()
7676

7777
matches, next_matches = self.log_pattern.finditer(content), self.log_pattern.finditer(content)
@@ -100,7 +100,7 @@ def iter_msg(self, watch: bool = False) -> Generator[Message, None, None]:
100100
msg_l.append(m)
101101

102102
for file in self.path.glob("**/*.pkl"):
103-
tag = ".".join(str(file.relative_to(self.path)).replace("/", ".").split(".")[:-3])
103+
tag = ".".join(file.relative_to(self.path).as_posix().replace("/", ".").split(".")[:-3])
104104
pid = file.parent.name
105105

106106
with file.open("rb") as f:

0 commit comments

Comments
 (0)