RuolinZheng08 / renpy-chess

A chess GUI built with Ren'Py, python-chess, and Stockfish. Version 2.0 of https://github.com/RuolinZheng08/renpy-chess-engine
https://r3dhummingbird.itch.io/renpy-chess-game
MIT License
74 stars 14 forks source link

Unexpcted Error #23

Closed ZYKsslm closed 2 months ago

ZYKsslm commented 2 months ago

When I choose Player vs. Computer -> Medium -> White, it occurred an error.

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 53, in script
    call screen chess(fen, player_color, movetime, depth)
  File "renpy/common/000statements.rpy", line 671, in execute_call_screen
    store._return = renpy.call_screen(name, *args, **kwargs)
  File "game/00-chess-engine/chess_displayable.rpy", line 108, in execute
    screen chess(fen, player_color, movetime, depth):
  File "game/00-chess-engine/chess_displayable.rpy", line 108, in execute
    screen chess(fen, player_color, movetime, depth):
  File "game/00-chess-engine/chess_displayable.rpy", line 113, in execute
    default chess_displayable = ChessDisplayable(fen=fen,
  File "game/00-chess-engine/chess_displayable.rpy", line 113, in <module>
    default chess_displayable = ChessDisplayable(fen=fen,
  File "game/00-chess-engine/chess_displayable.rpy", line 270, in __init__
    self.chess_subprocess.stdin.write('#'.join(['fen', fen, '\n']))
TypeError: a bytes-like object is required, not 'str'

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 53, in script
    call screen chess(fen, player_color, movetime, depth)
  File "F:\renpy-8.2.3-sdk\renpy\ast.py", line 1971, in execute
    self.call("execute")
  File "F:\renpy-8.2.3-sdk\renpy\ast.py", line 1953, in call
    return renpy.statements.call(method, parsed, *args, **kwargs)
  File "F:\renpy-8.2.3-sdk\renpy\statements.py", line 349, in call
    return method(parsed, *args, **kwargs)
  File "renpy/common/000statements.rpy", line 671, in execute_call_screen
    store._return = renpy.call_screen(name, *args, **kwargs)
  File "F:\renpy-8.2.3-sdk\renpy\exports.py", line 3420, in call_screen
    rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
  File "F:\renpy-8.2.3-sdk\renpy\ui.py", line 301, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "F:\renpy-8.2.3-sdk\renpy\display\core.py", line 2166, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, pause_modal=pause_modal, **kwargs) # type: ignore
  File "F:\renpy-8.2.3-sdk\renpy\display\core.py", line 2688, in interact_core
    root_widget.visit_all(lambda d : d.per_interact())
  File "F:\renpy-8.2.3-sdk\renpy\display\displayable.py", line 431, in visit_all
    d.visit_all(callback, seen)
  File "F:\renpy-8.2.3-sdk\renpy\display\displayable.py", line 431, in visit_all
    d.visit_all(callback, seen)
  File "F:\renpy-8.2.3-sdk\renpy\display\displayable.py", line 431, in visit_all
    d.visit_all(callback, seen)
  File "F:\renpy-8.2.3-sdk\renpy\display\screen.py", line 480, in visit_all
    callback(self)
  File "F:\renpy-8.2.3-sdk\renpy\display\core.py", line 2688, in <lambda>
    root_widget.visit_all(lambda d : d.per_interact())
  File "F:\renpy-8.2.3-sdk\renpy\display\screen.py", line 491, in per_interact
    self.update()
  File "F:\renpy-8.2.3-sdk\renpy\display\screen.py", line 697, in update
    self.screen.function(**self.scope)
  File "game/00-chess-engine/chess_displayable.rpy", line 108, in execute
    screen chess(fen, player_color, movetime, depth):
  File "game/00-chess-engine/chess_displayable.rpy", line 108, in execute
    screen chess(fen, player_color, movetime, depth):
  File "game/00-chess-engine/chess_displayable.rpy", line 113, in execute
    default chess_displayable = ChessDisplayable(fen=fen,
  File "game/00-chess-engine/chess_displayable.rpy", line 113, in <module>
    default chess_displayable = ChessDisplayable(fen=fen,
  File "game/00-chess-engine/chess_displayable.rpy", line 270, in __init__
    self.chess_subprocess.stdin.write('#'.join(['fen', fen, '\n']))
TypeError: a bytes-like object is required, not 'str'

Windows-10-10.0.19041 AMD64
Ren'Py 8.2.3.24061702
chess 1.0
Thu Aug 22 19:10:12 2024
ZYKsslm commented 2 months ago

it seems that the game only runs at the first time. Then it occurrs the error whatever you choose.

RuolinZheng08 commented 2 months ago

Hi @ZYKsslm. I think you are using the wrong version of this chess engine. Your log says you are running Ren'Py 8 but in your log there is also this:

  File "game/00-chess-engine/chess_displayable.rpy", line 270, in __init__
    self.chess_subprocess.stdin.write('#'.join(['fen', fen, '\n']))
TypeError: a bytes-like object is required, not 'str'

There's no chess_subprocess in the newest code on master. Closing the issue.