Birthday Reminder Application in Python - GeeksforGeeks

31 Dec, 2021
This app helps in reminding birthdays and notifying your friend’s birthdays. This app uses Python and Ubuntu notifications to notify users on every startup of the system.
# Python program For# Birthday Reminder Application  # time module is must as reminder # is set with the help of datesimport time  # os module is used to notify user # using default "Ubuntu" notification barimport os  # Birthday file is the one in which the actual birthdays# and dates are present. This file can be # manually edited or can be automated. # For simplicity, we will edit it manually.# Birthdays should be written in this file in# the format: "MonthDay Name Surname" (Without Quotes)  birthdayFile = '/path/to/birthday/file'  def checkTodaysBirthdays():    fileName = open(birthdayFile, 'r')    today = time.strftime('%m%d')    flag = 0    for line in fileName:        if today in line:            line = line.split(' ')            flag =1            # line[1] contains Name and line[2] contains Surname            os.system('notify-send "Birthdays Today: ' + line[1]            + ' ' + line[2] + '"')    if flag == 0:            os.system('notify-send "No Birthdays Today!"')  if __name__ == '__main__':    checkTodaysBirthdays()
Adding the script to Startup
After writing the above code now it is the time to add this Python script to startup. This can be done in Ubuntu as follows:
Firstly, we have to create an executable file for our reminder.py scriptThis can be done by typing the following command in the terminalsudo chmod +x reminder.py, where reminder.py is our script file name Now we have to transfer this file to the path where Linux searches for its default files:Type this command in terminal: sudo cp /path/to/our/reminder.py /usr/bin. This will add our executable script to /usr/bin.In global search, search for Startup ApplicationsClick on Add and Give a desired Name for your processType in the command. For example, our file name is reminder.py then type reminder.py in the command field and Select Add
Firstly, we have to create an executable file for our reminder.py script
This can be done by typing the following command in the terminalsudo chmod +x reminder.py, where reminder.py is our script file name 
sudo chmod +x reminder.py, where reminder.py is our script file name 
Now we have to transfer this file to the path where Linux searches for its default files:Type this command in terminal: sudo cp /path/to/our/reminder.py /usr/bin. This will add our executable script to /usr/bin.
 sudo cp /path/to/our/reminder.py /usr/bin
. This will add our executable script to /usr/bin.
In global search, search for Startup Applications
Click on Add and Give a desired Name for your process
Type in the command. For example, our file name is reminder.py then type reminder.py in the command field and Select Add
NOTE: The script runs automatically(once added to startup) everytime you start your system. Also, If you have more than two birthdays on the same day, both the birthdays will be notified in the notification.
How the birthday file should look like
Output after running the script
This article is contributed by Omkar Pathak. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
ddeevviissaavviittaa
Python-projects
python-utility
GBlog
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
DSA Sheet by Love Babbar
How to Start Learning DSA?
Supervised and Unsupervised learning
Differences between Procedural and Object Oriented Programming
Introduction to Recurrent Neural Network
Read JSON file using Python
Adding new column to existing DataFrame in Pandas
Python map() function
How to get column names in Pandas dataframe