MAMEToolkit icon indicating copy to clipboard operation
MAMEToolkit copied to clipboard

get Error "FileNotFoundError: [Errno 2] No such file or directory"

Open dbsxdbsx opened this issue 5 years ago • 3 comments

I got error like this, does it mean I have to compile it manually?

I just ran the example:

import random
from MAMEToolkit.sf_environment import Environment

# roms_path = "roms/sf2ceua"  # Replace this with the path to your ROMs
# roms_path = r"roms/"  # Replace this with the path to your ROMs
roms_path = "roms/"  # Replace this with the path to your ROMs
env = Environment("env1", roms_path)
env.start()
while True:
    move_action = random.randint(0, 8)
    attack_action = random.randint(0, 9)
    frames, reward, round_done, stage_done, game_done = env.step(
        move_action, attack_action)
    if game_done:
        env.new_game()
    elif stage_done:
        env.next_stage()
    elif round_done:
        env.next_round()

and got error like this:

root@dbsx-PC:/home/dbsx/Desktop/project# python try.py 
Traceback (most recent call last):
  File "try.py", line 2, in <module>
    see_games()
  File "/root/anaconda3/lib/python3.6/site-packages/MAMEToolkit/emulator/Emulator.py", line 33, in see_games
    Emulator("env1", "", "", {}, binary_path=binary_path)
  File "/root/anaconda3/lib/python3.6/site-packages/MAMEToolkit/emulator/Emulator.py", line 53, in __init__
    self.console = Console(roms_path, game_id, render=render, throttle=throttle, frame_skip=frame_skip, sound=sound, debug=debug, binary_path=binary_path)
  File "/root/anaconda3/lib/python3.6/site-packages/MAMEToolkit/emulator/Console.py", line 50, in __init__
    self.process = Popen(command, cwd=mame_path, shell=True, stdin=PIPE, stdout=PIPE)
  File "/root/anaconda3/lib/python3.6/subprocess.py", line 707, in __init__
    restore_signals, start_new_session)
  File "/root/anaconda3/lib/python3.6/subprocess.py", line 1333, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: '/root/anaconda3/lib/python3.6/site-packages/MAMEToolkit/emulator/mame'

Do I have to compile it ?

dbsxdbsx avatar Mar 15 '20 09:03 dbsxdbsx

Hey @dbsxdbsx did you find a solution? 🙂 I'm seeing the same error

uudens avatar Feb 03 '21 18:02 uudens

@uudens , I haven't paid attention on it for a long time. And no solution is found.

dbsxdbsx avatar Feb 07 '21 07:02 dbsxdbsx

Sounds like you need to compile MAME and move it to the installed MAMEToolkit python package folder:

git clone [email protected]:M-J-Murray/mame.git

Build MAME(use this if you installed SDL2 via homebrew on Big Sur and change version):

make -j 5 SUBTARGET=arcade REGENIE=1 SDL_INSTALL_ROOT=/usr/local/Cellar/sdl2/2.0.16 USE_LIBSDL=1

Copy it to the MAMEToolkit folder:

mkdir /Users/USER/PATH/TO/lib/python3.9/site-packages/MAMEToolkit/emulator/mame cp mamearcade /Users/USER/PATH/TO/lib/python3.9/site-packages/MAMEToolkit/emulator/mame/mame cp -r ini /USER/PATH/TO/lib/python3.9/site-packages/MAMEToolkit/emulator/mame cp -r bgfx /USER/PATH/TO/lib/python3.9/site-packages/MAMEToolkit/emulator/mame cp -r plugins /USER/PATH/TO/lib/python3.9/site-packages/MAMEToolkit/emulator/mame/ cp -r language /USER/PATH/TO/lib/python3.9/site-packages/MAMEToolkit/emulator/mame/

plasx avatar Oct 11 '21 15:10 plasx