A), not just one specific button.(venv) ➜ PokemonRAI python3 Maps_ai.py
UserWarning: Using SDL2 binaries from pysdl2-dll 2.32.0
Loading state from 'pallet_town_start.state'...
Loaded save state successfully.
AI Running... Press Ctrl+C in the terminal to stop.
Map: 0, Y: 12, X: 12
DEBUG: In Pallet Town Exterior (Map 0), attempting action UP
Sending PRESS...
ERROR during send_input/tick: an integer is required
Shutdown requested or loop finished. Exiting main AI loop.
Stopping PyBoy emulation...
(venv) ➜ PokemonRAI numpynumpypysdl2pysdl2pysdl2-dllpysdl2-dllPokemonRed.gb0xD35E0xD3610xD362pyboy.memory[address]pallet_town_start.statepyboy.save_state()Ctrl+Csignalpyboy.load_state()PRESS_ARROW_UPPRESS_BUTTON_Apyboy.send_input()pyboy.send_input()pyboy.send_input()pyboy.tick()pyboy.tick()pyboy.tick()pyboy.tick()exceptTypeError: an integer is requiredTypeError: an integer is requiredpyboy/utils.pypyboy.utils.WindowEvent.__init__UPDOWNwindow="SDL2"window="null"send_input("PRESS...")tick()tick()send_input("RELEASE...")send_input()send_input()send_input()send_input()load_state()debug=True, log_level="DEBUG"pip install --upgradeValueError: numpy.dtype size changed...--no-cache-dirdistutilspyboyWindowEventimport sys
import traceback # To print detailed error info
from pyboy import PyBoy
# --- Config ---
rom_path = "PokemonRed.gb"
# Make sure this state file exists and starts OUTSIDE Oak's Lab
state_filename = "pallet_town_start.state"
# Button that causes the crash (e.g., UP or A)
button_to_test = "PRESS_ARROW_UP"
pyboy = None # Define outside try
# --- Steps to Reproduce ---
try:
print("Initializing PyBoy...")
# Use "null" for minimal test, or "SDL2"
pyboy = PyBoy(rom_path, window="null")
pyboy.set_emulation_speed(1)
print("PyBoy Initialized.")
print(f"Loading state: {state_filename}")
with open(state_filename, "rb") as f:
pyboy.load_state(f)
print("State loaded.")
# Verify tick works before send_input
print("Performing initial tick...")
pyboy.tick()
print("Initial tick successful.")
# Attempt the problematic sequence
print(f"Sending input: {button_to_test}")
pyboy.send_input(button_to_test) # Call send_input
# Crash typically occurs here or during the next tick
print("Ticking after input...")
pyboy.tick() # Call tick immediately after
print("Tick successful after input.")
print("--- Sequence completed WITHOUT EXPECTED CRASH ---")
except Exception as e:
print(f"\n--- CRASH OCCURRED ---")
print(f"Error during send_input/tick sequence:")
# Print the full traceback for the bug report
traceback.print_exc()
print(f"--- END CRASH INFO ---")
finally:
if pyboy:
print("Stopping PyBoy.")
pyboy.stop()