[Bug] Error with getting the missing teachers
Describe the bug When using the substitution-cli.py there is always an error on getting the missing teachers.
Your code
python3 substitution-cli.py --format csv "FOO" "BAR" "BAZ"
Error message
File "/usr/local/lib/python3.9/dist-packages/edupage_api/substitution.py", line 67, in get_missing_teachers
_title, missing_teachers = missing_teachers_string.split(": ")
Expected behavior Get a list of missing teachers and the timetable for the next day.
Version
- Edupage API version: current, installed using pip (How do I get the version?)
- Python version: 3.9.2
Workaround To avoid the error (and skip missing teachers), edit edupage_api/substitution.py and return early.
def get_missing_teachers(self, date: date) -> Optional[list[EduTeacher]]:
html = self.__get_substitution_data(date)
missing_teachers_string = (html.split("<div class=\"header\"><span class=\"print-font-resizable\">")[1].split("</span>")[0])
if not missing_teachers_string:
return None
return []
line 121
action, lesson_n, title = change.split("</span>",3)[:-1]
I've added your suggestion (the maxsplit=3 argument).
You can update to 0.10.6:
pip install --upgrade edupage_api
Is the issue fixed?
Not really. I think we face 2 different problems.
The first is resolved by "return []" (return early) and ignoring everything. (line 69)
The second is the splitting of the timetable (line 121). This is fixed.
As I'm not sure, how the "missing_teachers_string" is supposed to look like (and my python is rather poor), I can't add a fix better than returning early and skipping the content.
Would it be possible for us to call on my discord server? We can debug the issue together.
Hi @aktienmakler! There has been no recent activity on this issue. The substitution code has been rewritten since the issue was opened. Is the problem still there or can I close this issue?
Closed as there has been no recent activity. Feel free to let us know if the problem persists :)