question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error accessing `notebook.metadata.language_info.file_extension`

See original GitHub issue

Copied from ExecutableBookProject/MyST-NB#63

jupyter-sphinx expects the presence of notebook.metadata.language_info.file_extension here: https://github.com/jupyter/jupyter-sphinx/blob/970097e01c1b7af04372be202aed572de68d2d20/jupyter_sphinx/execute.py#L259

However, it appears that this is not actual a necessary attribute of the notebook metadata, as exampled by the working notebook below:

{
 "nbformat": 4,
 "nbformat_minor": 2,
 "metadata": {
  "language_info": {
   "name": "python",
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   }
  },
  "orig_nbformat": 2,
  "file_extension": ".py",
  "mimetype": "text/x-python",
  "name": "python",
  "npconvert_exporter": "python",
  "pygments_lexer": "ipython3",
  "version": 3
 },
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "(use/api)=\n",
    "\n",
    "# Python API"
   ]
  }
 ]
}

Note, the notebook was initially created by VS Code:

Name: Python
Id: ms-python.python
Description: Linting, Debugging (multi-threaded, remote), Intellisense, Jupyter Notebooks, code formatting, refactoring, unit tests, snippets, and more.
Version: 2020.2.64397
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.python 

perhaps just have notebook.metadata.language_info.get("file_extension", ".py")

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
akhmerovcommented, Mar 12, 2020

I have confirmed, as per jupyter client kernel API, that file_extension is a compulsory metadata field in the kernel spec.

0reactions
chrisjsewellcommented, Mar 12, 2020

stupid VS Code lol

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jupytext documentation
notebook_metadata_filter : By default, Jupytext only exports the kernelspec and jupytext metadata to the text files. Set "jupytext": {" ...
Read more >
python - Error when installing ipywidgets jupyterlab extension ...
Error when installing ipywidgets jupyterlab extension on windows 10. I get this error message generated. Any way to go about it?
Read more >
The Jupyter Notebook Format — IPython 3.2.1 documentation
Jupyter (né IPython) notebook files are simple JSON documents, containing text, source code, rich media output, and metadata. each segment of the document ......
Read more >
The ipynb Jupyter Notebook File Extension - MLJAR
ipynb file extension is used for computational notebooks that can be open with Jupyter Notebook. The Jupyter Notebook was formerly named IPython ...
Read more >
Get Studio Notebook and App Metadata - Amazon SageMaker
You can access notebook metadata and App metadata using the Amazon SageMaker Studio UI.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found