From a7db47ff7825869ebb2e26643db9115f16c759c3 Mon Sep 17 00:00:00 2001 From: Philipp Weidel Date: Wed, 14 Mar 2018 12:24:05 +0100 Subject: [PATCH 1/2] fixed runtime errors for MC --- gymz-controller | 2 +- gymz/gym_wrapper.py | 2 +- gymz/messages.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gymz-controller b/gymz-controller index a39ce45..8986333 100755 --- a/gymz-controller +++ b/gymz-controller @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ diff --git a/gymz/gym_wrapper.py b/gymz/gym_wrapper.py index f5386a8..26c1c0d 100644 --- a/gymz/gym_wrapper.py +++ b/gymz/gym_wrapper.py @@ -94,7 +94,7 @@ def execute_action(self): # Gym expects actions in different format depending on type of # action space if isinstance(self._env.action_space, gym.spaces.Discrete): - action = self._command_buffer[0][0]['value'] + action = int(self._command_buffer[0][0]['value']) else: action = [self._command_buffer[0][0]['value']] diff --git a/gymz/messages.py b/gymz/messages.py index 154e283..b9ea0c3 100644 --- a/gymz/messages.py +++ b/gymz/messages.py @@ -6,6 +6,6 @@ def to_message(low, high, value): assert(np.shape(low) == np.shape(high) == np.shape(value)) try: - return [{'min': low[i], 'max': high[i], 'value': value[i]} for i in range(len(low))] + return [{'min': float(low[i]), 'max': float(high[i]), 'value': float(value[i])} for i in range(len(low))] except TypeError: - return [{'min': low, 'max': high, 'value': value}] + return [{'min': float(low), 'max': float(high), 'value': float(value)}] From 8c60ad8fa1cb88e8221181c53ef5299e595c2760 Mon Sep 17 00:00:00 2001 From: Philipp Weidel Date: Fri, 23 Mar 2018 18:14:10 +0100 Subject: [PATCH 2/2] use system python --- gymz-controller | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gymz-controller b/gymz-controller index 8986333..a39ce45 100755 --- a/gymz-controller +++ b/gymz-controller @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python # -*- coding: utf-8 -*- """