wilddom / memrise2anki-extension

An extension for Anki 2 that downloads and converts a course from Memrise into an Anki deck.
ISC License
159 stars 22 forks source link

KeyError: 'total_correct' on import #34

Closed novas0x2a closed 8 years ago

novas0x2a commented 8 years ago

Course: http://www.memrise.com/course/1252/intermediate-italian-2/ Rev: 6eb2c1218d76380866841b19adbf1ff685d4317b Anki Version: 2.0.36 (windows)

Trace:

An error occurred in an add-on.
Please post on the add-on forum:
https://anki.tenderapp.com/discussions/add-ons

Traceback (most recent call last):
  File "C:\Users\Mike\Documents\Anki\addons\Memrise_Course_Importer\importer.py", line 146, in run
    course = self.memriseService.loadCourse(self.url, MemriseCourseLoader.Observer(self))
  File "C:\Users\Mike\Documents\Anki\addons\Memrise_Course_Importer\memrise.py", line 725, in loadCourse
    return courseLoader.loadCourse(self.getCourseIdFromUrl(url))
  File "C:\Users\Mike\Documents\Anki\addons\Memrise_Course_Importer\memrise.py", line 555, in loadCourse
    level = self.loadLevel(course, levelIndex)
  File "C:\Users\Mike\Documents\Anki\addons\Memrise_Course_Importer\memrise.py", line 629, in loadLevel
    level.pool.schedule.add(self.loadScheduleInfo(userData, level.pool))
  File "C:\Users\Mike\Documents\Anki\addons\Memrise_Course_Importer\memrise.py", line 583, in loadScheduleInfo
    scheduleInfo.correct = data['total_correct']
KeyError: 'total_correct'
novas0x2a commented 8 years ago

I caught the KeyError and here's the contents of data at the time:

{
  "column_a": 1, 
  "column_b": 2, 
  "created_date": "2016-04-12T19:32:09", 
  "current_streak": 12, 
  "growth_level": 12, 
  "ignored": false, 
  "interval": 6.0, 
  "last_date": "2016-04-20T04:02:16", 
  "mem_id": null, 
  "next_date": "2016-04-21T19:38:40", 
  "thing_id": 4500371, 
  "user_id": redacted
}

Curious, it's missing the correct/incorrect information even though it looks like i've done this specific thing before.

novas0x2a commented 8 years ago

looking at levelData when that happens, none of the thingusers elements have a total_correct or total_incorrect. Did the api change?

wilddom commented 8 years ago

They are constantly changing things, so yes, it seems like they reduced the available data.

novas0x2a commented 8 years ago

Thanks!