VSCode Fails to Export Jupyter Notebook to HTML when using SQL + Python together

Viewed 272

everyone! I am using MySQL and Python together on a Jupyter Notebook in VSCODE. The imported environments are as under:

import mysql.connector
from sqlalchemy import create_engine
engine = create_engine("mysql+mysqlconnector://***:***@***/abc")
engine.connect()
print("***DONE***")

Along with

%load_ext sql
%sql mysql+mysqlconnector://***:***@***/abc
print("***SET***")

I am showing the above codes because all the other notebooks are being exported easily, but whenever MySQL engine is used on any notebook, that one notebook fails to export as HTML OR EVEN PDF. I need help on this!

I am also attaching the output that VSCODE is showing me (last few lines).

File "c:\users\yoyo\appdata\local\programs\python\python38\share\jupyter\nbconvert\templates\base\null.j2", line 31, in block "body_loop"
    {%- block any_cell scoped -%}
  File "c:\users\yoyo\appdata\local\programs\python\python38\share\jupyter\nbconvert\templates\base\null.j2", line 34, in block "any_cell"
    {%- block codecell scoped -%}
  File "c:\users\yoyo\appdata\local\programs\python\python38\share\jupyter\nbconvert\templates\lab\base.html.j2", line 12, in block "codecell"
    {{ super() }}
  File "c:\users\yoyo\appdata\local\programs\python\python38\share\jupyter\nbconvert\templates\base\null.j2", line 36, in block "codecell"
    {%- block input_group -%}
  File "c:\users\yoyo\appdata\local\programs\python\python38\share\jupyter\nbconvert\templates\lab\base.html.j2", line 19, in block "input_group"
    {{ super() }}
  File "c:\users\yoyo\appdata\local\programs\python\python38\share\jupyter\nbconvert\templates\base\null.j2", line 40, in block "input_group"
    {%- block input -%}{%- endblock input -%}
  File "c:\users\yoyo\appdata\local\programs\python\python38\share\jupyter\nbconvert\templates\lab\base.html.j2", line 27, in block "input"
    {{ cell.source | highlight_code(metadata=cell.metadata) }}
  File "c:\users\yoyo\appdata\local\programs\python\python38\lib\site-packages\nbconvert\filters\highlight.py", line 54, in __call__
    return _pygments_highlight(source if len(source) > 0 else ' ',
  File "c:\users\yoyo\appdata\local\programs\python\python38\lib\site-packages\nbconvert\filters\highlight.py", line 145, in _pygments_highlight
    lexer = get_lexer_by_name(language, stripall=True)
  File "c:\users\yoyo\appdata\local\programs\python\python38\lib\site-packages\pygments\lexers\__init__.py", line 113, in get_lexer_by_name
    _load_lexers(module_name)
  File "c:\users\yoyo\appdata\local\programs\python\python38\lib\site-packages\pygments\lexers\__init__.py", line 45, in _load_lexers
    mod = __import__(module_name, None, None, ['__all__'])
  File "c:\users\yoyo\appdata\local\programs\python\python38\lib\site-packages\pygments\lexers\sql.py", line 50, in <module>
    from pygments.lexers._mysql_builtins import \
ModuleNotFoundError: No module named 'pygments.lexers._mysql_builtins'

  at a.executeCommand (c:\Users\Yoyo\.vscode\extensions\ms-toolsai.jupyter-2021.5.745244803\out\client\extension.js:24:143662)
  at runMicrotasks (<anonymous>)
  at processTicksAndRejections (internal/process/task_queues.js:97:5)
  at async a.export (c:\Users\Yoyo\.vscode\extensions\ms-toolsai.jupyter-2021.5.745244803\out\client\extension.js:49:260205)
  at async _.exportToFormat (c:\Users\Yoyo\.vscode\extensions\ms-toolsai.jupyter-2021.5.745244803\out\client\extension.js:49:259171)
  at async _.performExport (c:\Users\Yoyo\.vscode\extensions\ms-toolsai.jupyter-2021.5.745244803\out\client\extension.js:49:258214)
  at async _.export (c:\Users\Yoyo\.vscode\extensions\ms-toolsai.jupyter-2021.5.745244803\out\client\extension.js:49:257728)
  at async m.export (c:\Users\Yoyo\.vscode\extensions\ms-toolsai.jupyter-2021.5.745244803\out\client\extension.js:32:323595)
  at async S._executeContributedCommand (c:\Users\Yoyo\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:86:106762)]

0 Answers
Related