Metadata-Version: 2.1
Name: gym-record
Version: 0.0.1
Summary: A recorder for open ai gym. you can easily add a text on the frame
Home-page: https://github.com/gyuta/gym_recorder
Author: gyuta
License: UNKNOWN
Project-URL: Bug Tracker, https://github.com/gyuta/gym_recorder/issues
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Requires-Dist: gym
Requires-Dist: opencv-python

# gym_recorder

# usage

```
pip install gym_recorder
```

```
import gym
from gym_recorder import Recorder

src_env = gym.make("CartPole-v1")
env = Recorder(src_env, episode_num=10)

for ep in range(10):
    obs = env.reset()
    done = False
    while not done:
        action = env.action_space.sample()
        n_obs, reward, done, info = env.step(action)

        env.txtqueue.append(f"episode:{ep}")
        env.txtqueue.append(f"obs:{obs}")
        env.txtqueue.append(f"action:{action}")
        env.txtqueue.append(f"reward:{reward}")
        env.txtqueue.append(f"next obs:{n_obs}")

```

## tips
this library depends on opencv-python. so you may need some library to use opencv. this is .Dockerfile example to resolve it.
```
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y libgl1-mesa-dev
```

if you use docker, you have to set "SDL_VIDEODRIVER" to "dummy".

add this to your .Dockerfile
```
ENV SDL_VIDEODRIVER=dummy
```
or simply add this to your script.
```
import os
os.environ["SDL_VIDEODRIVER"] = "dummy"
```

