[ARCHIVED] Add answers to question and receive CanvasException: Encountered an error: status code 500
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have added multiple choice quiz questions hundreds times to my course, but today I get an error when I run code that worked previously. Encountered an error: status code 500
I have narrowed the problem down to adding answer choices to multiple choice questions.
I see there has been a similar issue and I upgraded from canvasapi 0.12.0 to 2.2.0 and I run python 3.8.5. No luck.
This code works and creates a question with no answer choices:
quiz.create_question(question=dict(question_name='Question',
question_type='multiple_choice_question',
question_text='Here is a question',
points_possible=1.0))
This code generates the error:
quiz.create_question(question=dict(question_name='Question',
question_type='multiple_choice_question',
question_text='Here is a question',
points_possible=1.0,
answers=[{'text': 'Answer 1 is correct','weight': 100}, {'text': 'Answer 2 is incorrect','weight': 0}]
))
I tried manually adding the answers, requesting the question and passing back the dictionary with answers and no luck.
Any advice is appreciated,
Cara
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found the answer to this question here: https://github.com/ucfopen/canvasapi/issues/494
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.