Skip to content

Commit

Permalink
Merge pull request OpenInterpreter#742 from fatelei/fix-issue-209
Browse files Browse the repository at this point in the history
chore: popen using utf8 encoding
  • Loading branch information
KillianLucas authored Nov 15, 2023
2 parents eb3f2c7 + b54fc7e commit 3f0dbdb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions interpreter/code_interpreters/subprocess_code_interpreter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import queue
import subprocess
import threading
Expand Down Expand Up @@ -40,6 +41,8 @@ def start_process(self):
if self.process:
self.terminate()

my_env = os.environ.copy()
my_env['PYTHONIOENCODING'] = 'utf-8'
self.process = subprocess.Popen(
self.start_cmd.split(),
stdin=subprocess.PIPE,
Expand All @@ -48,6 +51,7 @@ def start_process(self):
text=True,
bufsize=0,
universal_newlines=True,
env=my_env
)
threading.Thread(
target=self.handle_stream_output,
Expand Down

0 comments on commit 3f0dbdb

Please sign in to comment.