copied the code exactly from the video, but when I try Python runs NameError.
I copied the code from the video to WorkSpace, and when I try to do yh = YatzyHand() in the console python raise NameError saying the name 'args' is not defined...
I even downloaded the zip file to get the code from this video only to find that python is raising NameError again.
So, my question is what is wrong?? Why is python doing this?
m hands.py code was this
from dice import D6 class Hand(list): def __init__(self, size = 0, die_class = None, *args, **kwargs): if not die_class: raise ValueError("You must provide a die class") super().__init__() for _ in range(size): self.append(die_class()) self.sort() class YatzyHand(Hand): def __init__(self, *args, **kwargs): super().__init__(size = 5, die_class = D6, *args, **kwargs)
Thank you for your time and interest. I did not know what you meant by stacktrace output, so I just tried to do yh = YatzyHand() again and copy the entire NameError python was raising and post here, and I don't know if it is because I had to reload my workspace due to inactivity, but now it works!?
I did not change a thing, so...
Either way Thank you!
I have same problem, trace is the following:
Traceback (most recent call last): File "<ipython-input-25-8ce6271ae554>", line 3, in <module> import game_kosti, game_kosti2 File "C:/python\game_kosti2.py", line 20, in <module> hand = game_kosti2.Hand(size=5, die_class = game_kosti.D6) File "C:/python\game_kosti2.py", line 16, in __init__ super.__init__() TypeError: descriptor '__init__' of 'super' object needs an argument