Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageData' object has no attribute 'data' #163

Closed
dp6000 opened this issue Jul 18, 2019 · 1 comment
Closed

ImageData' object has no attribute 'data' #163

dp6000 opened this issue Jul 18, 2019 · 1 comment

Comments

@dp6000
Copy link

dp6000 commented Jul 18, 2019

I ran the colab tutorial, '1_dqn_tutorial.ipynb' without making any changes. When running the code,

env.reset()
PIL.Image.fromarray(env.render())

The following error is reported:

AttributeErrorTraceback (most recent call last)
in ()
1 env.reset()
----> 2 PIL.Image.fromarray(env.render())

3 frames
/usr/local/lib/python2.7/dist-packages/gym/envs/classic_control/rendering.pyc in render(self, return_rgb_array)
94 buffer = pyglet.image.get_buffer_manager().get_color_buffer()
95 image_data = buffer.get_image_data()
---> 96 arr = np.fromstring(image_data.data, dtype=np.uint8, sep='')
AttributeErrorTraceback (most recent call last)
in ()
1 env.reset()
----> 2 PIL.Image.fromarray(env.render())

3 frames
/usr/local/lib/python2.7/dist-packages/gym/envs/classic_control/rendering.pyc in render(self, return_rgb_array)
94 buffer = pyglet.image.get_buffer_manager().get_color_buffer()
95 image_data = buffer.get_image_data()
---> 96 arr = np.fromstring(image_data.data, dtype=np.uint8, sep='')
97 # In openai/gym-http-api#2, we
98 # discovered that someone using Xmonad on Arch was having

AttributeError: 'ImageData' object has no attribute 'data'

@kuanghuei
Copy link
Contributor

It looks like a recent release of pyglet breaks gym. I downgraded pyglet to 1.3.2 for the colabs, and it should work now.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants