Skip to content

Commit

Permalink
updated python interface to support python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
nadavbh12 committed Mar 1, 2017
1 parent d1cf14a commit 546b8e7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion rle_python_interface/rle_python_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion test/python_interface_test.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down

0 comments on commit 546b8e7

Please sign in to comment.