canvasapi icon indicating copy to clipboard operation
canvasapi copied to clipboard

Create folder fails without warning

Open AbeHandler opened this issue 5 years ago • 1 comments

Describe the bug

I am using the API to create folders. Calls to course.create_folder intermittently fail, without errors

To Reproduce

Steps to reproduce the behavior, starting from a course with no files or folders, do the following

    course = canvas.get_course(my_course_id)
    for week in range(1, 17):
        print("[*] {}".format(week))
        parent = "/week{}/".format(week)
        course.create_folder(name='quiz_files', parent_folder_path=parent)
        course.create_folder(name='assignment_files', parent_folder_path=parent)
        course.create_folder(name='other_files', parent_folder_path=parent)

Expected behavior

I would expect to see 16 folders called week1, week2 ... week17, each with 3 subfolders called quiz_files, assignment_files and other_files. If I click each week1 folder etc in the web interface only some weekN folders have all of the 3 subdirectories. If the directories do not exist, I would expect to get an error message.

Environment information

  • Python version (3.7.7)
  • CanvasAPI version 2.0.0

AbeHandler avatar Aug 30 '20 17:08 AbeHandler

The Canvas endpoint returns a folder when it is successful. Have you tried adding any flow control checks that each folder was successfully created before trying to add a subfolder?

bennettscience avatar Oct 01 '20 16:10 bennettscience