fix path issue

This commit is contained in:
Benjamin Bertrand 2016-11-08 11:06:06 +03:00
parent 58f0c3fbbc
commit 95bcc6a16b
1 changed files with 5 additions and 3 deletions

View File

@ -8,6 +8,7 @@ from path import Path
notes_path = Path("./")
notStudent = ["Trimestre", "Nom", "Date", "Exercice", "Question", "Competence", "Domaine", "Commentaire", "Bareme", "Niveau"]
pure_marks = ["Malus", "Bonus", "Presentation"]
@ -33,10 +34,11 @@ def get_class_ws(classe, path = notes_path):
"""
From the name of a classe, returns pd.ExcelFile
"""
if classe in list_classes(path):
return pd.ExcelFile(notes_path/classe+".xlsx")
p = Path(path)
if classe in list_classes(p):
return pd.ExcelFile(p/classe+".xlsx")
else:
raise ValueError("This class is not disponible in {p}. You have to choose in {c}".format(p = path, c = list_classes(path)))
raise ValueError("This class is not disponible in {p}. You have to choose in {c}".format(p = p, c = list_classes(p)))
def extract_students(df, notStudent = notStudent):
""" Extract the list of students from df """