which seemed to go fine, and then I rebuilt the image. I then added "xblock_jupyter_viewer" to the module list but the xblock is not visible in my list of available advanced modules. This process has worked with other xblocks. What am I missing or what have I left out?
Thank you @qali
I was able to complete these steps without errors but unfortunately I am still not seeing the Jupyter Xblock Viewer option in my advanced module settings. I don’t have a good enough understanding of the steps you gave above to determine where the problem might be. Do you have any thoughts?
Thanks
I fixed it with editing " xblock_jupyter_viewer.py" file like this:
import logging
import pkg_resources
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
from django.urls import reverse
## from django.core.urlresolvers import reverse
from xblock.core import XBlock
from xblock.fields import Scope, String, Integer
from xblock.fragment import Fragment
from xblockutils.studio_editable import StudioEditableXBlockMixin
I was able to locate xblock_jupyter_viewer.py and edit it to match your example (leaving the functions at the bottom which you did not mention) but after this I rebuilt the image and saw the message cannot import name 'urlencode' from 'urllib'
although again the process seemed to finish. Now, however, I cannot even see the option for Advanced in my Modules. I didn’t change anything other than what you suggested so I’m not sure why you can see it and I can’t.
I would like to try your solution for sure. I still need to find out what is wrong here though. Here is the error I am getting after implementing your suggestions and rebuilding the image.
I thought maybe my problem was just because I copied your lines above directly and realized they had curly quotes in them rather than plain ones, but it was not so simple.
Unable to load XBlock 'xblock_jupyter_viewer'
Traceback (most recent call last):
File "/openedx/venv/lib/python3.8/site-packages/xblock/plugin.py", line 141, in load_classes
yield (class_.name, cls._load_class_entry_point(class_))
File "/openedx/venv/lib/python3.8/site-packages/xblock/plugin.py", line 70, in _load_class_entry_point
class_ = entry_point.load()
File "/openedx/venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2443, in load
return self.resolve()
File "/openedx/venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2449, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/openedx/venv/lib/python3.8/site-packages/xblock_jupyter_viewer/__init__.py", line 1, in <module>
from .xblock_jupyter_viewer import JupyterViewerXBlock
File "/openedx/venv/lib/python3.8/site-packages/xblock_jupyter_viewer/xblock_jupyter_viewer.py", line 5, in <module>
from urllib import urlencode
ImportError: cannot import name 'urlencode' from 'urllib' (/opt/pyenv/versions/3.8.6/lib/python3.8/urllib/__init__.py)