Closed DiddiLeija closed 2 years ago
R
key is currently working for me in all scenarios. Pyxel 1.5.8
So this is an upstream bug (the current requirement is pyxel==1.6.1
).
Will fix this, but maybe after my online exams (today's exam and I have 2 hours left to study!) Thanks
Absolutely no worries for the time, and I hope you will do it well on your exams!
The exact exception I had is:
C:\Users\Diego Ramirez\diddi-and-the-bugs>main.py
Traceback (most recent call last):
File "C:\Users\Diego Ramirez\diddi-and-the-bugs\main.py", line 137, in update
self.__init__()
File "C:\Users\Diego Ramirez\diddi-and-the-bugs\main.py", line 124, in __init__
self.enemies = [Enemy() for sth in range(200)]
File "C:\Users\Diego Ramirez\diddi-and-the-bugs\main.py", line 124, in <listcomp>
self.enemies = [Enemy() for sth in range(200)]
File "C:\Users\Diego Ramirez\diddi-and-the-bugs\main.py", line 46, in __init__
self.aspect = random.choice(self.possible_enemies)
File "C:\Users\Diego Ramirez\AppData\Local\Programs\Python\Python39\lib\random.py", line 346, in choice
return seq[self._randbelow(len(seq))]
RecursionError: maximum recursion depth exceeded while calling a Python object
C:\Users\Diego Ramirez\diddi-and-the-bugs>
When we call R
, we call App.__init__
again:
This happens in the update
function.
So, I suppose Pyxel has changed its way to call update
and draw
in version 1.6, generating some kind of recursion. Then, easy things like getting random.choice
will crash.
Ok! I fixed this... will open a PR tomorrow morning!
Thanks! Just remember to add a Closes #20
sentence with the first post of the PR!
This bug was caused by recalling the pyxel.run()
method, which causes a recursion
here's the bugfix PR: https://github.com/DiddiLeija/diddi-and-the-bugs/pull/22
This is a bug I found while confirming #18. When you loose, pause or win, it's impossible to use the
R
key to restart. I don't remember this happened with old Pyxel releases, so maybe it's an upstream thing?