Video transcript upload generates 500 error

Hi @regis

I was going through the system checking if everything all right. I found that uploading a video transcript generates an error!

tutor local logs --tail=100 cms

 | 2020-08-05 21:13:32,032 ERROR 19 [django.request] [user 3] - Internal Server Error: /transcripts/upload
cms_1              | Traceback (most recent call last):
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/", line 34, in inner
cms_1              |     response = get_response(request)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/", line 115, in _get_response
cms_1              |     response = self.process_exception_by_middleware(e, request)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/", line 113, in _get_response
cms_1              |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
cms_1              |   File "/opt/pyenv/versions/3.5.9/lib/python3.5/", line 30, in inner
cms_1              |     return func(*args, **kwds)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/django/contrib/auth/", line 21, in _wrapped_view
cms_1              |     return view_func(request, *args, **kwargs)
cms_1              |   File "/openedx/edx-platform/cms/djangoapps/contentstore/views/", line 234, in upload_transcripts
cms_1              |     file_data=ContentFile(sjson_subs),
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/edxval/", line 387, in create_or_update_video_transcript
cms_1              |     video_transcript, __ = VideoTranscript.create_or_update(video, language_code, metadata, file_data)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/edxval/", line 534, in create_or_update
cms_1              |, transcript_file_data)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/django/db/models/fields/", line 87, in save
cms_1              | =, content, max_length=self.field.max_length)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/django/core/files/", line 52, in save
cms_1              |     return self._save(name, content)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/storages/backends/", line 495, in _save
cms_1              |     self._save_content(obj, content, parameters=parameters)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/storages/backends/", line 510, in _save_content
cms_1              |     obj.upload_fileobj(content, ExtraArgs=put_parameters)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/boto3/s3/", line 513, in object_upload_fileobj
cms_1              |     ExtraArgs=ExtraArgs, Callback=Callback, Config=Config)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/boto3/s3/", line 431, in upload_fileobj
cms_1              |     return future.result()
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/s3transfer/", line 73, in result
cms_1              |     return self._coordinator.result()
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/s3transfer/", line 233, in result
cms_1              |     raise self._exception
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/s3transfer/", line 126, in __call__
cms_1              |     return self._execute_main(kwargs)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/s3transfer/", line 150, in _execute_main
cms_1              |     return_value = self._main(**kwargs)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/s3transfer/", line 692, in _main
cms_1              |     client.put_object(Bucket=bucket, Key=key, Body=body, **extra_args)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/botocore/", line 317, in _api_call
cms_1              |     return self._make_api_call(operation_name, kwargs)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/botocore/", line 596, in _make_api_call
cms_1              |     request_signer=self._request_signer, context=request_context)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/botocore/", line 242, in emit_until_response
cms_1              |     responses = self._emit(event_name, kwargs, stop_on_response=True)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/botocore/", line 210, in _emit
cms_1              |     response = handler(**kwargs)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/botocore/", line 209, in conditionally_calculate_md5
cms_1              |     calculate_md5(params, **kwargs)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/botocore/", line 187, in calculate_md5
cms_1              |     binary_md5 = _calculate_md5_from_file(body)
cms_1              |   File "/openedx/venv/lib/python3.5/site-packages/botocore/", line 201, in _calculate_md5_from_file
cms_1              |     md5.update(chunk)
cms_1              | TypeError: Unicode-objects must be encoded before hashing


Hi @nachham! It appears that your upload is failing because it contains non-ASCII characters, such as éàÜ… Also, the error occurs in the s3/boto layer of the code, indicating that you are uploading to an S3 bucket. Are you using the tutor-minio plugin? Can you please share your transcript file so that we can attempt to reproduce the issue?

As a general rule, you should remember to indicate the tutor version that you are running as well as the list of enabled plugins. Both informations can be obtained by running:

tutor --version
tutor plugins list

Hi @regis

Thanks for reaching out!

I was (i said i was because i rolled back to Ironwood) having this issue with Tutor 10.1.0 and Minio 10.1.0. (No S3 was in use)

Yes, the srt file name had a special character … But that was not a problem in Ironwood!
What was strange, Juniper failed to import the srt file of the default video (that of the founder of openedx). Juniper generates the 500 error too…it has no special character tough!

Sorry i cannot reproduce the error (as I downgraded Tutor)… but @juansele seems to have a similar issue, he may provide the log file…

Moreover, the decision to remove the vertical navigation in course main page is “questionable”. Very disappoinintg is the least to say. See Sections and Subsections' strange behavior on Fresh Install

At least, there could have been an option admins can decide if they want to enable or disable this feature…


Nonetheless, can you please share the transcript file that causes the issue? I’d like to investigate this further.

Sent to your email box.

I’m having a similar error. I think there are some breaking changes when updating from python2 to python3.
This is perfectly fine with python2 but broke with python3

So I came up with a patch:

It basically just encode the transcript content before passing to ContentFile

Apply it to Dockerfile and rebuild image:

RUN curl | git apply -

Thanks @nguyennk92

Oh God I didn’t see your message @nguyennk92 and I just spent two hours figuring out the exact same solution: :sob: Good job solving this though! The patch will be included in the next tutor release.

1 Like

FYI this problem is also discussed here:
It appears that the problem still occurs in Koa, so I re-opened my PR: