From 546b8e7efa31965561321a818553a5d5b2ccca11 Mon Sep 17 00:00:00 2001 From: Nadav Bhonker Date: Wed, 1 Mar 2017 11:13:46 +0200 Subject: [PATCH] updated python interface to support python 3 --- rle_python_interface/rle_python_interface.py | 6 +++++- setup.py | 2 +- test/python_interface_test.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/rle_python_interface/rle_python_interface.py b/rle_python_interface/rle_python_interface.py index c563863..05f76e6 100644 --- a/rle_python_interface/rle_python_interface.py +++ b/rle_python_interface/rle_python_interface.py @@ -7,6 +7,7 @@ import numpy as np from numpy.ctypeslib import as_ctypes import os +import sys rle_lib = cdll.LoadLibrary(os.path.join(os.path.dirname(__file__), 'librle_c.so')) @@ -123,7 +124,10 @@ def loadROM(self, rom_file, core): else: raise ValueError('core must be atari|snes|genesis|game_gear|sg1000') - rle_lib.loadROM(self.obj, rom_file, core_path) + if (sys.version_info > (3, 0)): + rle_lib.loadROM(self.obj, str.encode(rom_file), str.encode(core_path)) + else: + rle_lib.loadROM(self.obj, rom_file, core_path) def act(self, actionA, actionB = 0): return rle_lib.act(self.obj, int(actionA), int(actionB)) diff --git a/setup.py b/setup.py index 366fb01..5541882 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ def run(self): ds.spawn(['./copy_cores.sh']) _build.build.run(self) -version = '1.1.3' +version = '1.1.4' setup(name = 'rle_python_interface', version=version, description = 'Retro Learning Environment Python Interface based on Ben Goodrich\'s work', diff --git a/test/python_interface_test.py b/test/python_interface_test.py index fe5d524..d9aa1ea 100644 --- a/test/python_interface_test.py +++ b/test/python_interface_test.py @@ -1,6 +1,6 @@ import unittest import os -from rle_python_interface import RLEInterface +from rle_python_interface.rle_python_interface import RLEInterface import numpy as np