def update_html_symlink(html_dir):
    """"Maintail symlink: "today.html", "yesterday.html" """
    today = datetime.date.today()
    yesterday = datetime.date.today() - datetime.timedelta(days=1)

    for from_date, alias_name in (
            (today, 'today.html'), (yesterday, 'yesterday.html')):
        from_date_file_path = os.path.join(html_dir, 'day_%s.html' % from_date)
        symlink_path = os.path.join(html_dir, alias_name)
        try:                                                                                         
            os.unlink(symlink_path)                                                                  
        except OSError:                                                                              
            pass                                                                                     
        os.symlink(from_date_file_path, symlink_path)
dataset/ETHPy150Open piglei/uwsgi-sloth/uwsgi_sloth/commands/start.py/update_html_symlink/original