edupage-api icon indicating copy to clipboard operation
edupage-api copied to clipboard

[Bug] Error with getting the missing teachers

Open aktienmakler opened this issue 2 years ago • 4 comments

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]

aktienmakler avatar Nov 24 '23 21:11 aktienmakler

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?

ivanhrabcak avatar Dec 09 '23 22:12 ivanhrabcak

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.

aktienmakler avatar Dec 10 '23 16:12 aktienmakler

Would it be possible for us to call on my discord server? We can debug the issue together.

ivanhrabcak avatar Dec 10 '23 22:12 ivanhrabcak

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?

BelKed avatar Apr 07 '24 22:04 BelKed

Closed as there has been no recent activity. Feel free to let us know if the problem persists :)

BelKed avatar Jul 11 '24 13:07 BelKed