#πŸ”’ To-do app.

12 messages Β· Page 1 of 1 (latest)

sturdy dirge
#

Hello everyone, I managed to create a to-do app works fine when I run it but when I choose an option in the list then it crushes I have tried solving it but not getting it right.
my Error says name 'self' is not defined and I don't understand. Thank you all for the feedback.

//Error message
Enter your choice (1-5): 1
Traceback (most recent call last):
File "/home/wu-ling/development/TO_DO_APP/main.py", line 69, in <module>
self.create_task()
^^^^
NameError: name 'self' is not defined

marsh nebulaBOT
#

@sturdy dirge

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

cedar bobcat
#

it looks like the main loop of your application is not inside a method of ToDoApp, and self isn't defined in the module scope

#

you could either create a method (run/mainloop or similar) and move the main loop there, create an instance of your class and then call todoapp.run() at the bottom of your program, or create an instance of your class before your while True loop and replace self with whatever variable contains your instance

#

I suspect that you mean to do the latter here

#

and, just for future reference, when you include your code as an image, it is pretty tricky to read, especially when there's a lot of it. Uploading your code into a paste site (like https://paste.pythondiscord.com/) makes it a lot easier to read

sturdy dirge
marsh nebulaBOT
# sturdy dirge

Please react with βœ… to upload your file(s) to our paste bin, which is more accessible for some users.

sinful ravine
mild depot
marsh nebulaBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.