'Qlabel not updating with setText() in PyQt5 from csv data

I'm learning to create an program on PyQt5 that saves a name in local storage using csv file .

The problem is that the QLabel does not update with setText() every time I switch on window and re enter a name

Here is my code for retrieving the data.

    filename = "temp_user_name.csv"
    with open(filename, 'r') as r:
        csv_reader = csv.reader(r)
        for line_no , line in enumerate(csv_reader , 1):
            if line_no == 2:
                name = (line[0])
                self.lblName.setText(name)  #still displaying the same name that previously entered
    self.lblName.repaint() #this doesn't work


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source