Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Error with getting the missing teachers #72

Open
aktienmakler opened this issue Nov 24, 2023 · 4 comments
Open

[Bug] Error with getting the missing teachers #72

aktienmakler opened this issue Nov 24, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@aktienmakler
Copy link

aktienmakler commented Nov 24, 2023

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 aktienmakler added the bug Something isn't working label Nov 24, 2023
ivanhrabcak added a commit that referenced this issue Dec 9, 2023
@ivanhrabcak
Copy link
Collaborator

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?

@aktienmakler
Copy link
Author

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.

@ivanhrabcak
Copy link
Collaborator

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

@BelKed BelKed changed the title [Bug] [Bug] Error with getting the missing teachers Apr 7, 2024
@BelKed
Copy link
Collaborator

BelKed commented Apr 7, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants