overhangio / openedx-scorm-xblock

SCORM XBlock for Open edX
GNU Affero General Public License v3.0
39 stars 50 forks source link

ValueError: I/O operation on closed file. #7

Closed mumarkhan999 closed 4 years ago

mumarkhan999 commented 4 years ago

On juniper release of openedx, with all the s3 buckets configured, when I try to upload a scorm course zip file I get this error

Internal Server Error: /xblock/block-v1:EDX+E101+2020_E+type@scorm+block@57eff9f97a5c41248eea66bf9e4c92f8/handler/studio_submit
Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.5/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.5/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.5/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python3.5/contextlib.py", line 30, in inner
    return func(*args, **kwds)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.5/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/edx/app/edxapp/edx-platform/cms/djangoapps/contentstore/views/component.py", line 478, in component_handler
    resp = handler_descriptor.handle(handler, req, suffix)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.5/site-packages/xblock/mixins.py", line 89, in handle
    return self.runtime.handle(self, handler_name, request, suffix)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1453, in handle
    return super(MetricsMixin, self).handle(block, handler_name, request, suffix=suffix)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.5/site-packages/xblock/runtime.py", line 1063, in handle
    results = handler(request, suffix)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.5/site-packages/openedxscorm/scormxblock.py", line 228, in studio_submit
    with zipfile.ZipFile(package_file, "r") as scorm_zipfile:
  File "/usr/lib/python3.5/zipfile.py", line 1026, in __init__
    self._RealGetContents()
  File "/usr/lib/python3.5/zipfile.py", line 1089, in _RealGetContents
    endrec = _EndRecData(fp)
  File "/usr/lib/python3.5/zipfile.py", line 241, in _EndRecData
    fpin.seek(0, 2)
ValueError: I/O operation on closed file.

In S3 bucket, some zip file is also created when I try to upload scorm course zip file through studio image

regisb commented 4 years ago

Unfortunately I can't reproduce this, as I don't use S3. Can you try to reproduce with the tutor-minio plugin? https://pypi.org/project/tutor-minio/

lunika commented 4 years ago

I have the same error on Ironwood when I use S3 or Swift. The version of openedx-scorm-xblock used is 9.2.4 and django-storage shipped with Ironwood is used.

The storage is defined with XBLOCK_SETTINGS.ScormXBlock.STORAGE_FUNC setting.

EDIT : In fact it's not really the same error, I open an other issue.

regisb commented 4 years ago

Closing this now. @mumarkhan999 please re-open if you are still encountering this issue, in particular with the tutor-minio plugin.