Hola,
Actualmente estoy desarrollando un complemento JMP que se basa en scripts de Python integrados.
Al iniciarse, el complemento instala los paquetes de Python necesarios (utilizando un repositorio wheel local) antes de ejecutar cualquier código Python.
El problema al que me enfrento es que, cuando se inicia el complemento por primera vez, a veces no logra ejecutar las funciones de Python integradas definidas en los archivos enviados inmediatamente después de la instalación del paquete.
It looks like JMP continues executing the script antes de que el proceso de instalación de PowerShell se haya completado realmente.
The error I get is that Python cannot find one of the functions defined in the two Python Submit File calls.
Después de la primera instalación exitosa, todo funciona bien (probablemente porque los paquetes ya están presentes y los scripts se cargan correctamente).
How can I make sure that JMP waits until the PowerShell installation process is fully completed before running Python Submit File()?
Aquí está la parte relevante de mi código:
strPathjpip = dest_path || "\jpip.bat";
If( !File Exists( strPathjpip ),
Python Send( dest_path );
Python Submit( "
import jmp
import jmputils
jmputils.create_jpip(dest_path)
" );
);
// Build command to run
cmd = Eval Insert( "\[& "^strPathjpip^" install --no-index --find-links "^strPathPythonLibs^" numpy pandas scipy]\" );
Eval( Eval Expr( commands = {Expr( cmd )} ) );
icommand = 0;
// Use Run Program to execute the script
rp = Run Program(
Executable( "PowerShell.exe" ),
ReadFunction( Function( {this}, Write( this << Read ) ) ),
WriteFunction(
Function( {this},
icommand++;
If( icommand <= N Items( commands ),
this << Write( commands[icommand] ),
this << WriteEOF
);
)
)
);
// Include Python scripts
Python Submit File( strPathAddin || "include/PYTHON/exttolint.py" );
Python Submit File( strPathAddin || "include/PYTHON/normtolint.py" );
Usar la función de lectura ("texto") es una opción
Names Default To Here(1);
RP = Run Program(
Executable("PING.EXE"/*path probably not needed*/ ),
Options({"-n 5", "localhost"}),
ReadFunction("text")
);
Show(RP);
Write("\!NDONE");