Skip to content

Commit 7f1d4ab

Browse files
authored
Merge pull request #57 from speglich/jupyter-integration
ckp: Fix PyRevolve freezing when run in jupyter.
2 parents d0e7e60 + ca82bf4 commit 7f1d4ab

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

pyrevolve/tools.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,10 @@ def stop(self):
4848
"""
4949
Stop capturing the stream data and save the text in `capturedtext`.
5050
"""
51-
5251
# Print the escape character to make the readOutput method stop:
53-
self.origstream.write(self.escape_char)
52+
os.write(self.pipe_in, self.escape_char.encode())
5453
# Flush the stream to make sure all our data goes in before
5554
# the escape character:
56-
self.origstream.flush()
5755
if self.threaded:
5856
# wait until the thread finishes so we are sure that
5957
# we have until the last character:
@@ -74,7 +72,7 @@ def readOutput(self):
7472
and save the text in `capturedtext`.
7573
"""
7674
while True:
77-
char = os.read(self.pipe_out, 1).decode(self.origstream.encoding)
75+
char = os.read(self.pipe_out, 1).decode()
7876
if not char or self.escape_char in char:
7977
break
8078
self.capturedtext += char

0 commit comments

Comments
 (0)