Corrections workflow - Ricecooker

Hello,
I have a channel I created through a ricecooker script. I was trying the corrections workflow which is mentioned in the ricecooker docs.

I have my credentials/studio.json file correctly setup. But when I run the main command corrections export <channel_id>, I get the following error:

Traceback (most recent call last):
  File ".local/lib/python3.10/site-packages/requests/models.py", line 974, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".local/bin/corrections", line 8, in <module>
    sys.exit(correctionsmain())
  File ".local/lib/python3.10/site-packages/ricecooker/utils/corrections.py", line 703, in correctionsmain
    export_corrections_csv(args)
  File ".local/lib/python3.10/site-packages/ricecooker/utils/corrections.py", line 617, in export_corrections_csv
    api = get_studio_api()
  File ".local/lib/python3.10/site-packages/ricecooker/utils/corrections.py", line 605, in get_studio_api
    api = StudioApi(
  File ".local/lib/python3.10/site-packages/ricecooker/utils/libstudio.py", line 27, in __init__
    self.licenses_by_id = self.get_licenses()
  File ".local/lib/python3.10/site-packages/ricecooker/utils/libstudio.py", line 85, in get_licenses
    licenses_list = response.json()
  File ".local/lib/python3.10/site-packages/requests/models.py", line 978, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

I can’t seem to understand the error. Is it related to license or am I simply getting an empty response?

Please let me know on this. Thank you.

Regards,
Essa, FESF

Hello @essa
according to your message, it seems you have an error in the json file.
Please, check specially the " and , characters in the text, they can be mocked when copied and pasted from the browser.

Regards
José

I don’t quite get what you mean here.

I’ve deciphered that one of the errors is coming from using the StudioApi class. When an object of StudioApi class is instantiated, the __init__ method sets the license attr as follows:
image

The get_licenses(self) function is defined as:
image

The issue is that the url LICENSES_LIST_ENDPOINT is giving a 404 response, where LICENSES_LIST_ENDPOINT = https://studio.learningequality.org/api/license along with the headers.

Hence, seems like the url no longer exists or something.

P.S.:
I’m getting the same exact error when I’m running the following code (which is exactly the error related to when instantiating the StudioApi class:
image

Please let me know on this. Thank you.

Hi @essa,

Sorry, the documentation is not up to date. The corrections workflow is not supported, and will not work. I will update the documentation, thanks for bringing this to our attention.

Kind Regards,
Richard

oh, sorry for the misundersanding, you mentioned at the beginning of your message credentials/studio.json and I thought the problem was there as it’s a json deconding error.

I’m afraid the error is caused for the removal of that json api in studio in 2020 and docs not being updated.

As @richard has just mentioned this feature is not available since then and docs must be fixed to reflect it.

Regards

1 Like