0

I am trying to get a specific value 'ename' from Juputer Notebook on event of:

events.on('execute.CodeCell', function(evt, data) {
    var outputs = data.cell.output_area.outputs; //this works
    console.log(outputs[0].ename) //this does not work
}

The above code does not give the required result. While, if I check the same in the Browser, it shows the required result

Required result

The type of data in the screenshot is an Array. I am not sure why does it not work. It throws this error:

error

Please let me know what is wrong in my code or am I missing something. Thanks

1 Answers1

0

Found an answer to my own question which will do the trick. It is not actually a solution but it works for me. Referring to @ibrahim mahrir answers here, as the code runs from a file that is locally stored, it take time to read. So I need to add a wait time for it.

events.on('execute.CodeCell', function(evt, data) {
  setTimeout(function() {
    var outputs = data.cell.output_area.outputs;
    console.log(outputs[0].ename)
  }, 1000);
}