4

I am able to execute some python code in JavaScript, using the execute method of the Jupyter notebook kernel and get some text result.

In order to do so, the executed code needs to contain some print statement, e.g.

var pythonCode = "print('hello')";

Furthermore, some callback structure is passed to the execute method:

Jupyter.notebook.kernel.execute(phytonCode, callbackStructure);

and that works fine.

However, I also would like to be able to retrieve the html output, that is shown below a notebook cell if a variable name is on the last line of the cell, e.g. the tabular display of a dataFrame:

enter image description here

If I do not use a print statement in the executed python code, the iopub part of the callback structure does not seem to be called and I was not able to retrieve the result.

=> How can I retrieve the html output that corresponds to some python code I would like to execute?

Related questions:

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.