Staff Graded Point Block Not Working

In the maple version: overhangio/openedx:13.2.2 (prod & staging)

I’m trying to import a staff graded points spreadsheet, but I always get the message:

File "/openedx/venv/lib/python3.8/site-packages/botocore/handlers.py", line 209, in conditionally_calculate_md5,
    calculate_md5(params, **kwargs),
  File "/openedx/venv/lib/python3.8/site-packages/botocore/handlers.py", line 187, in calculate_md5,
    binary_md5 = _calculate_md5_from_file(body),
  File "/openedx/venv/lib/python3.8/site-packages/botocore/handlers.py", line 201, in _calculate_md5_from_file,
    md5.update(chunk),
TypeError: Unicode-objects must be encoded before hashing,

Versions used of the responsible libraries:

boto                          2.39.0
boto3                         1.4.8
botocore                      1.8.17
staff-graded-xblock           1.6.0
super-csv                     2.1.1

The strange thing is that, in the same file that is exported by OpenedX, within the plugin itself, I just change the New points column to 1, as in the example:

user_id,username,full_name,student_uid,enrolled,track,cohort,block_id,title,date_last_graded,who_last_graded,Previous Points,New Points
125753,zeuser,zename,,True,audit,,block-v1:migration_test+CALIF+2024_07+type@staffgradedxblock+block@e83ee91ab56c4386a9358feab3ae7238,Staff Graded Points,,,,1

I had done a test of taking this same file, converting it to utf8 on some random website, however, I got the following result:

<csv.DictReader object at 0x7fb2cb7c5ee0>,
columns:::::: ['\ufeffuser_id', 'username', 'full_name', 'student_uid', 'enrolled', 'track', 'cohort', 'block_id', 'title', 'date_last_graded', 'who_last_graded', 'Previous Points', 'New Points'],

Missing column: user_id
Error: super-csv/super_csv/csv_processor.py at 2.1.1 · openedx/super-csv · GitHub


In another environment (dev), the encoding problem does not occur, and the following result is returned after uploading within the CMS, however, the course progress is also not counted:

{
    "total": 0,
    "processed": 0,
    "saved": 0,
    "error_rows": [],
    "error_messages": [],
    "percentage": "0.0%",
    "can_commit": false,
    "result_id": null,
    "saved_error_id": null,
    "waiting": false
}

Notes:

  • All environments run the same image
  • The difference between the environments is the amount of resources

Link for reference [python - How to correct TypeError: Unicode-objects must be encoded before hashing? - Stack Overflow]

Plugin responsible for “staff_graded”: [GitHub - openedx/staff_graded-xblock: Staff Graded Points XBlock]

Dependency on the “staff grade” plugin in open edX: [edx-platform/requirements/edx/base.txt at open-release/maple.master · openedx/edx-platform · GitHub]

Entry gate during upload: [staff_graded-xblock/staff_graded/staff_graded.py at master · openedx/staff_graded-xblock · GitHub]

What am I doing wrong?

Why is the plugin internally unable to handle the received encoding?

I appreciate any help or advice in advance.

1 Like

Hi @zevitagem!

Maple… it’s quite an old version. Please try with the latest one, libraries are usually upgraded and maybe the error is gone. I just tried in a Palm site and worked without problems.
Try to edit the file with a plain text editor, avoid any spreadsheet program that may insert unwanted characters.

Hope it helps!
Andrés.

P.S.: Btw, what prevents you to upgrade to a newer version? Just for curiosity.

1 Like

First of all, thank you very much for your response and help.

Today, we have several plugins connected to the Maple version. Until 6 months ago, we were using Lilac to get an idea, lol

I’m here racking my brains, but I don’t see any other alternative than updating the packages and checking if I can maintain compatibility even in the Maple version. My leader did some tests using the versions:
+RUN pip install boto3==1.7.0
+RUN pip install botocore==1.10.84
+RUN pip install staff-graded-xblock==2.0.1
+RUN pip install super-csv==3.0.1

And, it seems to have worked well.

Best regards

I see. Thanks for your insight, it is really appreciated. I agree that custom developments frequently difficult the upgrade process. Fortunately the Open edX platform is evolving notably in the direction of extensibility and plugability, which will certainly ease the way we extend and integrate with custom tools, without sacrificing maintainability. Hope you can move soon to the latest versions, because they do have lots of cool features.

Good luck with that! If I can be or any help just drop me an email to andres@aulasneo.com.

Regards,
Andrés.

1 Like