redkyn / assigner

:black_nib: Automatically assign programming homework to students on GitLab.
MIT License
27 stars 6 forks source link

ERROR list index out of range #166

Closed ASolvie closed 3 years ago

ASolvie commented 3 years ago

Hello so I think I have pinpointed the source of the issue but I am not sure how to fix it. The issue is when I run the command "assigner new hw1" it say "ERROR list index out of range" the index that is out of range is the namespace because it is empty which is because the json is empty. All of this is happening in the gitlab.py def _cls_gl_get(cls, config, path, params={}): """Make a Gitlab GET request""" headers = {"Private-Token": config["token"]} url = urljoin(config["host"], "/api/v4" + path) r = requests.get(url, params=params, headers=headers) r.raise_for_status() return r.json() the r.json() is an empty list. I don't think it is supposed to be either. the URL is https://git-classes.mst.edu/api/v4/namespaces the params is {'search': '2021-FS-CS3800'} the header is {'Private-Token': token} the token is an actual token so I won't be sharing it on here unless it is required.

LinuxMercedes commented 3 years ago

Yep, that's bug -- we should handle that case better. Thanks for finding it!

Does the 2021-FS-CS3800 group exist on git-classes.mst.edu? If so, something weird is going on here; if not, you'll need to create it yourself.

I'll put together a more informative error message and maybe an interactive prompt to create the group if it's missing tomorrow.

LinuxMercedes commented 3 years ago

@ASolvie I've got a test build for you; send me an email (jarus@mst.edu) and I'll send it your way.