-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
Fix #9. compatibility for tostring and tobytes #10
Conversation
Can we do this without catching the exception? It'd be nicer to know in advance which method we should use, and then just make one attempt. Otherwise we risk catching an unintended error. |
@gdb How about checking the version of numpy? Because |
Sounds great! On Thursday, April 28, 2016, Taehoon Kim [email protected] wrote:
Sent from mobile |
@@ -281,7 +281,10 @@ def capture_frame(self, frame): | |||
if frame.dtype != np.uint8: | |||
raise error.InvalidFrame("Your frame has data type {}, but we require uint8 (i.e. RGB values from 0-255).".format(frame.dtype)) | |||
|
|||
self.proc.stdin.write(frame.tobytes()) | |||
if np.__version__ >= '1.9.0': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think we need to do something more sophisticated here:
>>> '1.10.0' >= '1.9.0'
False
Try using Disutils version parsing, like we do here: https://github.com/openai/mujoco-py/blob/master/mujoco_py/config.py#L45?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should do the work:
distutils.version.StrictVersion(numpy.__version__) >= distutils.version.StrictVersion('1.9.0')
@gdb: Now the version check is done as: if distutils.version.StrictVersion(np.__version__) >= distutils.version.StrictVersion('1.9.0'):
self.proc.stdin.write(frame.tobytes())
else:
self.proc.stdin.write(frame.tostring()) |
Thank you! |
No description provided.