Romern / syncMyMoodle

Synchronization client for RWTH Moodle
GNU General Public License v3.0
72 stars 18 forks source link

Can not sync course #28

Closed autoantwort closed 3 years ago

autoantwort commented 3 years ago

The first time I started the programm I got the following:

ip-074:syncMyMoodle xx$ ./syncMyMoodle.py 
Logging in...
Syncing file tree...
Syncing (VO) Compilerbau...
Traceback (most recent call last):
  File "/Users/xx/git_projekte/syncMyMoodle/./syncMyMoodle.py", line 555, in <module>
    smm.sync()
  File "/Users/xx/git_projekte/syncMyMoodle/./syncMyMoodle.py", line 264, in sync
    section_node = course_node.add_child(section["name"], section["id"], "Section")
TypeError: string indices must be integers

and if I rerun:

ip-074:syncMyMoodle xx$ ./syncMyMoodle.py 
Logging in...
Syncing file tree...
Traceback (most recent call last):
  File "/Users/xx/git_projekte/syncMyMoodle/./syncMyMoodle.py", line 555, in <module>
    smm.sync()
  File "/Users/xx/git_projekte/syncMyMoodle/./syncMyMoodle.py", line 239, in sync
    for course in self.get_all_courses():
  File "/Users/xx/git_projekte/syncMyMoodle/./syncMyMoodle.py", line 135, in get_all_courses
    return json.loads(resp.json()["responses"][0]["data"])
KeyError: 'responses'
autoantwort commented 3 years ago

It only happens with the course (VO) Compilerbau. If I remove the course from selected_courses everything works.

Romern commented 3 years ago

Compilerbau somehow sometimes throws exceptions on the server side. The error should now be catched: https://github.com/Romern/syncMyMoodle/commit/cf8753b4408c9f6bf593d75775e89c3daf8a0800