Change language

Birthday reminder app in Python


# Python program for
# Birthday reminder app

# the time module should be a reminder
# set using dates

import time

# the os module is used to notify the user
# using the notification bar & quot; Ubuntu & quot; default

import os

# Birthday file where actual birthdays
# and dates are present. This file can be
# manually edited or automated.
# We’ll edit it for simplicity manually.
# Birthdays must be written in this file in
# format: & quot; Last name Name of the month & quot; (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 the first name and line [2] contains the last name

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 a script to autoload

After writing the above code, it’s time to add this Python script to run. This can be done in Ubuntu as follows:

  1. First, we need to create an executable file for our script
  2. This can be done by typing the following command in the terminal
      sudo chmod + x , where is our script file name 
  3. Now we need to transfer this file along the path where Linux looks for default files:
    Enter this command in a terminal:
      sudo cp /path/to/our/ / usr / bin  

    This will add our executable script to / usr / bin.

  4. In the global search, search for Startup Applications
  5. Click on Add and give the desired name for your process
  6. Enter the command. For example, our filename —, then enter in the command field and select Add.

NOTE . The script runs automatically (after being added to startup) every time the system starts. Also, if you have more than two birthdays on the same day, both notifications will be notified in a notification.

What the birthday file should look like

Output after script run

This article is provided by Omkar Pathak . If you are as Python.Engineering and would like to contribute, you can also write an article using or by posting the article [email protected] ... See my article appearing on the Python.Engineering homepage and help other geeks.

Please post comments if you find anything wrong or if you would like to share more information on the topic discussed above.


Learn programming in R: courses


Best Python online courses for 2022


Best laptop for Fortnite


Best laptop for Excel


Best laptop for Solidworks


Best laptop for Roblox


Best computer for crypto mining


Best laptop for Sims 4


Latest questions


psycopg2: insert multiple rows with one query

12 answers


How to convert Nonetype to int or string?

12 answers


How to specify multiple return types using type-hints

12 answers


Javascript Error: IPython is not defined in JupyterLab

12 answers



Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method