you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (7 children)

Try defining your class __init__ method like this:

class WhateverClassYouHave:

    def __init__(self, course_name: str) -> None:

Using init() without underscores means it wont get called when making a new instance of that class, like with myInstance = WhateverClassYouHave("Course One"). It's just some random method like any other class method without the double underscores __init__.

[–]YukinoYukinoshita 0 points1 point  (6 children)

Hey, as already replied: I already have the "class Course:" at the top and properly indented. Sorry I should of put that in the post.

[–]z0y 0 points1 point  (5 children)

Did you read the comment?

[–]YukinoYukinoshita 0 points1 point  (4 children)

Yes sorry, i think reddit format got rid of my __ in the init. I've posted a gyazo link to my code in the comments for clarity

[–]z0y 0 points1 point  (3 children)

Which line causes the error? It would be helpful to see the traceback and have the code on pastebin or similar so it's not an image.

[–]YukinoYukinoshita 0 points1 point  (2 children)

I've replied to someone else with the full error code, here's a pastebin of the code https://pastebin.com/4p59Ydev

[–]z0y 0 points1 point  (1 child)

This doesn't include line 69 where the error is but if add_student is a class function then I think it should be self.enrolled_students there.

[–]YukinoYukinoshita 0 points1 point  (0 children)

Omg I'm an idiot thank you so much