import subprocess import shutil import os import random import pandas as pd #Note that this script doesn't work inside protected Windows folders (such as "Documents") password="Reset{:04d}".format(random.randint(0,10000)) inStr=input('Are you sure? Type "'+password+'" to reset the state of the databases and files to the "start-of-semester-state"\nThis action cannot be undone!\n') if inStr==password: subprocess.call(['cmd','/c',"python sectionCSVHelper.py"],shell=True) shutil.copy("sectionsDatabase.csv", "sectionsDatabase_Orig.csv") shutil.copy("startOfSemesterInputs\\archivedSubRequests.csv","archivedSubRequests.csv") with open("lastUpdatedToken.txt", 'w') as f: f.write("2022-10-04 15:15:51.231447") with open('substitutionRequestForm.csv', 'r') as fin: data = fin.read().splitlines(True) with open('substitutionRequestForm.csv', 'w') as fout: fout.writelines(data[:1]) stfD = pd.read_csv("staffDatabase.csv",dtype=str,index_col=False) stfD['Approved Substitutions'].values[:]=0 stfD['Accepted Substitutions'].values[:]=0 stfD['Rejected Substitutions'].values[:]=0 stfD['Cancelled Substitutions'].values[:]=0 stfD['Fulfilled Substitutions'].values[:]=0 stfD.to_csv("staffDatabase.csv",index=False,index_label=False) else: print('You typed somethinge other than "Reset'+password+'". Exiting')