Hi,
I browsed through the nodejs example here. It uses a python script to start the jupyter notebook server. My question is if it’s possible to connect to an already started notebook session from node?
I tried by passing baseUrl also as part of the options. However, I got the following error.
16 Jul 10:19:28 - Error: Can only be used for notebook server requests
at Object.handleRequest (C:\Users\idling-mind\.node-red\externalModules\node_modules\@jupyterlab\services\lib\serverconnection.js:177:19)
at Object.makeRequest (C:\Users\idling-mind\.node-red\externalModules\node_modules\@jupyterlab\services\lib\serverconnection.js:77:24)
at Object.startNew (C:\Users\idling-mind\.node-red\externalModules\node_modules\@jupyterlab\services\lib\kernel\restapi.js:55:64)
at KernelManager.startNew (C:\Users\idling-mind\.node-red\externalModules\node_modules\@jupyterlab\services\lib\kernel\manager.js:152:39)
I am trying to connect Node-RED to a jupyter-kernel.
Hi there! I registered here only because I was trying to do the same as you, and finally figured it out. So I will leave the solution here for anyone interested in doing the same.
after sessionManager declaration.
The variables I used were:
let baseUrl = “http://localhost:8888/”;
let wsUrl = “ws://localhost:8888/”;
let token = “9eb6c845cb1e68cc2331b6f83fbfe82343a49a232945d35e”;
The URLs will probably be the same if you start jupyter lab with the default settings, but the token will change everytime, so it is useful to create a function that starts the server and parses the output to get the token. I will do this in the near future, and if I remember, will update this post!
P.S.: I also had to remove the lines with “process” in it.