Your Community is getting an upgrade!
Read about our partnership with Higher Logic and how we will build the next generation of the Instructure Community.
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.
I found the answer to this question here: https://github.com/ucfopen/canvasapi/issues/494
This did not fix the problem, but I shared a dictionary with answers formatted incorrectly. This is the dictionary that fails.
{'question_name':'Question',
'question_type':'multiple_choice_question',
'question_text':'Here is a question',
'points_possible':1.0,
'answers':[
{'answer_text': 'Answer 1 is correct',
'answer_weight': 100},
{'answer_text': 'Answer 2 is incorrect',
'answer_weight': 0}]}
I found the answer to this question here: https://github.com/ucfopen/canvasapi/issues/494
To interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign InTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign In
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.