Closed firasm closed 4 years ago
What OS are you on? I have only tested on Windows.
You didn't provide the program a Canvas URL, so it tried to check the settings (md2canvas/config.ini) but didn't find a section called settings. I just tried cloning and running it fresh and didn't get this (even without supplying a URL).
I'm on macOS 10.15.6.
Ah, missing -u flag was my bad! New error now.
Relevant traceback:
Uploading quiz to Canvas with following settings:
URL = https://canvas.ubc.ca/courses/45445
Token = 1122**************************************************************cUgE
Course ID = 45445
Traceback (most recent call last):
File "/Users/firasm/.pyenv/versions/3.8.3/bin/md2canvas", line 8, in <module>
sys.exit(md2canvas())
File "/Users/firasm/.pyenv/versions/3.8.3/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/Users/firasm/.pyenv/versions/3.8.3/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/Users/firasm/.pyenv/versions/3.8.3/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/firasm/.pyenv/versions/3.8.3/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/Users/firasm/.pyenv/versions/3.8.3/lib/python3.8/site-packages/md2canvas/command.py", line 115, in md2canvas
j2c.upload_quiz(quiz, url, token, course_id)
File "/Users/firasm/.pyenv/versions/3.8.3/lib/python3.8/site-packages/md2canvas/json2canvas.py", line 197, in upload_quiz
canvas_course = get_course(url, token, course_id)
File "/Users/firasm/.pyenv/versions/3.8.3/lib/python3.8/site-packages/md2canvas/json2canvas.py", line 141, in get_course
return canvas.get_course(course_id)
File "/Users/firasm/.pyenv/versions/3.8.3/lib/python3.8/site-packages/canvasapi/canvas.py", line 638, in get_course
response = self.__requester.request(
File "/Users/firasm/.pyenv/versions/3.8.3/lib/python3.8/site-packages/canvasapi/requester.py", line 242, in request
raise ResourceDoesNotExist("Not Found")
canvasapi.exceptions.ResourceDoesNotExist: Not Found
Do I need to have the quiz created already in Canvas with the same name?
Full result
A test quiz with all supported question types and some sample metadata.
\nPart of this github.
\nHere is a picture of a flower:
\n", "image_paths": [ { "name": "media/flower.jpg", "path": "/Users/firasm/Sync/Teaching/utilities/md2canvas/examples/sample_quiz/media/flower.jpg" } ], "title": "Test Canvas Quiz", "allowed_attempts": 3, "scoring_policy": "keep_highest", "cant_go_back": false, "shuffle_answers": false }, "groups": [ { "attrs": { "name": "general" }, "questions": [ { "question_name": "1", "question_type": "essay_question", "points_possible": 5, "answers": [], "question_text": "Write your name here!
", "image_paths": [] }, { "question_name": "2", "question_type": "file_upload_question", "points_possible": 1, "answers": [], "question_text": "Upload a file, any file (note this will not work in preview mode)!
", "image_paths": [] }, { "question_name": "3", "question_type": "matching_question", "points_possible": 1, "answers": [ { "answer_match_left": "a", "answer_match_right": "a" }, { "answer_match_left": "b", "answer_match_right": "b" }, { "answer_match_left": "c", "answer_match_right": "c" }, { "answer_match_left": "d", "answer_match_right": "d" } ], "question_text": "Match the same letters to each other.
\nLeft
\nRight
\nChoose the odd numbers.
\nWhat is the correct answer?
\nType \"something\" or \"nothing\".
", "image_paths": [] }, { "question_name": "7", "question_type": "text_only_question", "points_possible": 1, "answers": [], "question_text": "Take a break!
", "image_paths": [] }, { "question_name": "8", "question_type": "true_false_question", "points_possible": 1, "answers": [ { "answer_text": "True", "answer_weight": 100 }, { "answer_text": "False", "answer_weight": 0 } ], "question_text": "Write true to get full marks.
", "image_paths": [] } ] }, { "attrs": { "name": "numerical questions", "pick_count": 1, "question_points": 3, "quesnum": 1 }, "questions": [ { "question_name": "9", "question_type": "numerical_question", "points_possible": 1, "answers": [ { "answer_text": "", "answer_weight": 100, "numerical_answer_type": "exact_answer", "answer_exact": 4.0, "answer_error_margin": 0 }, { "answer_text": "", "answer_weight": 100, "numerical_answer_type": "exact_answer", "answer_exact": 4.0, "answer_error_margin": 0.1 }, { "answer_text": "", "answer_weight": 100, "numerical_answer_type": "exact_answer", "answer_exact": 4.0, "answer_error_margin": 0.1 }, { "answer_text": "", "answer_weight": 100, "numerical_answer_type": "range_answer", "answer_range_start": 3.9, "answer_range_end": 4.1 }, { "answer_text": "", "answer_weight": 100, "numerical_answer_type": "precision_answer", "answer_approximate": 4.0, "answer_precision": 2.0 } ], "question_text": "What is ?
", "image_paths": [] }, { "question_name": "10", "question_type": "numerical_question", "points_possible": 1, "answers": [ { "answer_text": "", "answer_weight": 100, "numerical_answer_type": "exact_answer", "answer_exact": 5.0, "answer_error_margin": 0 }, { "answer_text": "", "answer_weight": 100, "numerical_answer_type": "exact_answer", "answer_exact": 5.0, "answer_error_margin": 0.1 }, { "answer_text": "", "answer_weight": 100, "numerical_answer_type": "exact_answer", "answer_exact": 5.0, "answer_error_margin": 0.1 }, { "answer_text": "", "answer_weight": 100, "numerical_answer_type": "range_answer", "answer_range_start": 4.9, "answer_range_end": 5.1 }, { "answer_text": "", "answer_weight": 100, "numerical_answer_type": "precision_answer", "answer_approximate": 5.0, "answer_precision": 2.0 } ], "question_text": "What is ?
", "image_paths": [] }, { "question_name": "11", "question_type": "numerical_question", "points_possible": 1, "answers": [ { "answer_text": "", "answer_weight": 100, "numerical_answer_type": "exact_answer", "answer_exact": 6.0, "answer_error_margin": 0 }, { "answer_text": "", "answer_weight": 100, "numerical_answer_type": "exact_answer", "answer_exact": 6.0, "answer_error_margin": 0.1 }, { "answer_text": "", "answer_weight": 100, "numerical_answer_type": "exact_answer", "answer_exact": 6.0, "answer_error_margin": 0.1 }, { "answer_text": "", "answer_weight": 100, "numerical_answer_type": "range_answer", "answer_range_start": 5.9, "answer_range_end": 6.1 }, { "answer_text": "", "answer_weight": 100, "numerical_answer_type": "precision_answer", "answer_approximate": 6.0, "answer_precision": 2.0 } ], "question_text": "Evaluate the following expression.
", "image_paths": [] } ] } ] } Uploading quiz to Canvas with following settings: URL = https://canvas.ubc.ca/courses/45445 Token = 1122**************************************************************cUgE Course ID = 45445 Traceback (most recent call last): File "/Users/firasm/.pyenv/versions/3.8.3/bin/md2canvas", line 8, inIt should be able to create an entirely new quiz. It will only attempt to update an existing quiz if you give it a quiz ID. It looks like it failed to get the course, are you sure that the course ID you used is correct?
Hmm - yea, looks correct to me (screenshot below): 45445
Oops I missed it in your previous comment, the URL shouldn't include the course, just https://canvas.ubc.ca
aha! That worked!!
Thank you, I will update my instructions in #9
I just tried running md2canvas, but I ran into an error:
The command I ran was:
The error I got was:
Haven't had a chance to debug this yet... let me know if you have any ideas.