I am creating a web based python IDE using the Skulpt JavaScript library (and codemirror).
When I execute python code from the editor, which contains several print statements followed by an input statement, the print statements do not execute until an input is entered, which is not the expected behaviour.
How can I ensure that code which precedes an input statement is executed?
Here is my Skulpt KS configuration code, within the runit function:
function runit() {
var prog = myCodeMirror.getValue();
var mypre = document.getElementById("output");
mypre.innerHTML = '';
Sk.pre = "output";
Sk.configure({
output:outf,
read:builtinRead,
inputfun: function (prompt) {
return window.prompt(prompt);
},
inputfunTakesPrompt: true,
});
(Sk.TurtleGraphics || (Sk.TurtleGraphics = {})).target = 'mycanvas';
var myPromise = Sk.misceval.asyncToPromise(function() {
return Sk.importMainWithBody("<stdin>", false, prog, true);
});
myPromise.then(function(mod) {
console.log('success');
},
function(err) {
console.log(err.toString());
outf(err.toString());
});
}