Giter Club home page Giter Club logo

Comments (2)

Carreau avatar Carreau commented on July 20, 2024

Indented for readability.

{'cells': [{'cell_type': 'code',
   'execution_count': None,
   'metadata': {'collapsed': True},
   'outputs': [],
   'source': []}],
 'metadata': {'kernelspec': {'display_name': 'Python 3',
   'language': 'python',
   'name': 'python3'},
  'language_info': {'codemirror_mode': {'name': 'ipython', 'version': 3},
   'file_extension': '.py',
   'mimetype': 'text/x-python',
   'name': 'python',
   'nbconvert_exporter': 'python',
   'pygments_lexer': 'ipython3',
   'version': '3.4.2'}},
 'nbformat': 4,
 'nbformat_minor': 0}

So one of the issues (at least for nnode2) is that in-memory cells[x].source is supposed to be a string, and not a list of string. Which get through the validation process as we have only 1 schema for disk and in-memory (for historical reasons)

We should probably make these distinction and methods more accurate/documented/robust.

from nbconvert.

minrk avatar minrk commented on July 20, 2024

If you have the raw JSON in-memory, you need to convert it to the in-memory format:

from nbformat.v4 import to_notebook
nb = to_notebook(nb_dict)

If you got the JSON string somehow (it presumably came from somewhere), you can get a notebook with nbformat.reads(json_string) instead of json.loads(json_string)

from nbconvert.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.