Skip to content

Commit cfc54bd

Browse files
authored
Update python_interpreter.py (#8501)
* Update python_interpreter.py fix UnicodeDecodeError: 'gbk' error * Update base_module.py fix UnicodeDecodeError: 'gbk'
1 parent f456807 commit cfc54bd

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

dspy/primitives/base_module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def load(self, path):
248248
path = Path(path)
249249

250250
if path.suffix == ".json":
251-
with open(path) as f:
251+
with open(path, encoding="utf-8") as f:
252252
state = ujson.loads(f.read())
253253
elif path.suffix == ".pkl":
254254
with open(path, "rb") as f:

dspy/primitives/python_interpreter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def _ensure_deno_process(self) -> None:
127127
stdout=subprocess.PIPE,
128128
stderr=subprocess.PIPE,
129129
text=True,
130+
encoding="UTF-8",
130131
env=os.environ.copy()
131132
)
132133
except FileNotFoundError as e:

0 commit comments

Comments
 (0)