Closed ptitzler closed 6 years ago
You can run the Node.js sub-process from the command-line with:
node pixiedust_node/pixiedustNodeRepl.js
and type some commands:
var a = 1;
{"_pixiedust":true,"type":"variable","key":"a","datatype":"number","value":1}
var b = 2;
{"_pixiedust":true,"type":"variable","key":"b","datatype":"number","value":2}
var c = 3;
{"_pixiedust":true,"type":"variable","key":"c","datatype":"number","value":3}
display(c)
{"_pixiedust":true,"type":"display","data":3}
display(a)
{"_pixiedust":true,"type":"display","data":1}
Notice how the second call to display
works just fine.
But within a Notebook, after the first call to display
no subsequent Node.js cells work. The cell data isn't even transferred to the Node.js process as far as I can see
Although the Node.js repl behaves on its own, calling display
somehow disturbs the connection between Python & Node.js
If I comment out this line https://github.com/ibm-watson-data-lab/pixiedust_node/blob/master/pixiedust_node/node.py#L47 then everything works again. This is the line that moves Python variables to Node.js if they have changed.
Another fix is to call node.cancel()
in a Python cell. This sends "\r\n.break\r\n" from Python to the Node.js repl and seems to unblock the communication.
Fixed in pixiedust_node 0.2.2.
It was fixed by preventing Python --> Node variable migration when the variable names were Node.js reserved words e.g. true
.
PD 1.1.7, PD_node 0.2.1
...