My ursina game crash every time i press the key "2"

Viewed 22

I'm making a Minecraft clone with Ursina engine and when i press the key "2" my game crash.I have already tried to update python and ursina but it doesn't solve my problem.

here is my code:

from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
class Voxel(Button):
    def __init__(self, position = (0,0,0)):
        super().__init__(
            parent = scene,
            position = position,
            model = 'cube',
            origin_y = 0.5,
            texture = 'white_cube',
            color = color.color(0,0,random.uniform(0.9,1)),
            highlight_color = color.lime)
    def input(self, key):
        if self.hovered:
            if key == 'right mouse down':
                voxel = Voxel(position= self.position + mouse.normal)
            if key == 'left mouse down':
                destroy(self)
class Sky(Entity):
    def __init__(self):
        super().__init__(
            parent = scene,
            model = 'sphere',
            texture='sky_default',
            color = color.white,
            scale=300,
            double_sided=True
        )
app = Ursina()
def update ():
    if held_keys ['escape']:
        quit()

for z in range (20):
    for x in range (20):
        voxel = Voxel(position=(x,0,z))
sky = Sky()
player = FirstPersonController()
input_handler.rebind('z', 'w')
input_handler.rebind('q', 'a')
app.run()

this is just a basic minecraft clone so i don't understan why this key is making the game crash i'm not even using it in my code. and i got this error message when i press 2:

Traceback (most recent call last):
  File "C:\Users\Clément\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\EventManager.py", line 49, in eventLoopTask
    self.doEvents()
  File "C:\Users\Clément\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\EventManager.py", line 43, in doEvents
    processFunc(dequeueFunc())
  File "C:\Users\Clément\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\EventManager.py", line 99, in processEvent
    messenger.send(eventName, paramList)
  File "C:\Users\Clément\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\Messenger.py", line 337, in send
    self.__dispatch(acceptorDict, event, sentArgs, foundWatch)
  File "C:\Users\Clément\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\Messenger.py", line 422, in __dispatch
    result = method (*(extraArgs + sentArgs))
  File "C:\Users\Clément\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\main.py", line 239, in keystroke
    key = str(KeyboardButton.asciiKey(key))
TypeError: Arguments must match:
ascii_key(char ascii_equivalent)

:task(error): Exception occurred in PythonTask eventManager
Traceback (most recent call last):
  File "c:\Users\Clément\Desktop\Pycraft\pycraft.py", line 41, in <module>
    app.run()
  File "C:\Users\Clément\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\main.py", line 281, in run
    super().run()
  File "C:\Users\Clément\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\ShowBase.py", line 3330, in run
    self.taskMgr.run()
  File "C:\Users\Clément\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\task\Task.py", line 553, in run
    self.step()
  File "C:\Users\Clément\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\task\Task.py", line 504, in step
    self.mgr.poll()
  File "C:\Users\Clément\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\EventManager.py", line 49, in eventLoopTask
    self.doEvents()
  File "C:\Users\Clément\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\EventManager.py", line 43, in doEvents
    processFunc(dequeueFunc())
  File "C:\Users\Clément\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\EventManager.py", line 99, in processEvent
    messenger.send(eventName, paramList)
  File "C:\Users\Clément\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\Messenger.py", line 337, in send
    self.__dispatch(acceptorDict, event, sentArgs, foundWatch)
  File "C:\Users\Clément\AppData\Local\Programs\Python\Python310\lib\site-packages\direct\showbase\Messenger.py", line 422, in __dispatch
    result = method (*(extraArgs + sentArgs))
  File "C:\Users\Clément\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\main.py", line 239, in keystroke
    key = str(KeyboardButton.asciiKey(key))
TypeError: Arguments must match:
ascii_key(char ascii_equivalent)
0 Answers
Related