Skip to content

Commit

Permalink
make recent text env changes python 2/3 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
pzhokhov committed Feb 9, 2019
1 parent 8bcd125 commit e65b61f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion gym/envs/tests/test_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def test_random_rollout():


def test_env_render_result_is_immutable():
from six import string_types
environs = [
envs.make('Taxi-v2'),
envs.make('FrozenLake-v0'),
Expand All @@ -60,5 +61,5 @@ def test_env_render_result_is_immutable():
for env in environs:
env.reset()
output = env.render(mode='ansi')
assert isinstance(output, str)
assert isinstance(output, string_types)
env.close()
3 changes: 2 additions & 1 deletion gym/wrappers/monitoring/video_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ def __init__(self, output_path, frames_per_sec):
self.frames = []

def capture_frame(self, frame):
from six import string_types
string = None
if isinstance(frame, str):
if isinstance(frame, string_types):
string = frame
elif isinstance(frame, StringIO):
string = frame.getvalue()
Expand Down

0 comments on commit e65b61f

Please sign in to comment.