Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

189
Vistas
How do I ensure that preceding Python code is executed before a user input is entered?

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()); 
   });
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda