M-J-Murray / MAMEToolkit

A Python toolkit used to train reinforcement learning algorithms against arcade games
GNU General Public License v2.0
642 stars 114 forks source link

Error No output expected from command 'mem = manager:machine().devices[":maincpu"].spaces["program"]' #27

Open consciousgaze opened 4 years ago

consciousgaze commented 4 years ago

I tried to see my game id by running e = Emulator("test_env", roms_path, "", {}, binary_path="/usr/local/lib/python3.6/dist-packages/MAMEToolkit/emulator/mame/mamearcade64")

But I got error of

No output expected from command 'mem = manager:machine().devices[":maincpu"].spaces["program"]', but recieved: error:   [string "..."]:2: attempt to index a nil value (field ':maincpu')
Traceback (most recent call last):
  File "test.py", line 15, in <module>
    test_mame()
  File "test.py", line 7, in test_mame
    e = Emulator("test_env", roms_path, "", {}, binary_path="/usr/local/lib/python3.6/dist-packages/MAMEToolkit/emulator/mame/mamearcade64")
  File "/usr/local/lib/python3.6/dist-packages/MAMEToolkit/emulator/Emulator.py", line 56, in __init__
    self.create_lua_variables()
  File "/usr/local/lib/python3.6/dist-packages/MAMEToolkit/emulator/Emulator.py", line 91, in create_lua_variables
    self.console.writeln('mem = manager:machine().devices[":maincpu"].spaces["program"]')
  File "/usr/local/lib/python3.6/dist-packages/MAMEToolkit/emulator/Console.py", line 94, in writeln
    raise IOError(error)
OSError: No output expected from command 'mem = manager:machine().devices[":maincpu"].spaces["program"]', but recieved: error:  [string "..."]:2: attempt to index a nil value (field ':maincpu')

Did I set up things right? or this is a MAME issue?

NOTE: By running pip3 install MAMEToolkit, MAME isn't installed and the .mame isn't found. So I built mame my self with

cd /usr/local/lib/python3.6/dist-packages/MAMEToolkit/emulator && \                             
git clone https://github.com/M-J-Murray/mame.git && cd mame && \                                
make SUBTARGET=arcade -j4
rwa commented 3 years ago

I also encountered this error but it does not appear to be fatal. Note that you won't see the id in brackets until you start the game - I got stuck wondering where the game id's were for quite awhile before realizing that.