안녕하세요,
저는 현재 내장된 Python 스크립트를 사용하는 JMP 추가 기능을 개발하고 있습니다.
시작 시, 추가 기능은 Python 코드를 실행하기 전에 필요한 Python 패키지를 설치합니다(로컬 wheel 저장소를 사용).
제가 겪고 있는 문제는, 애드인을 처음 실행할 때 패키지 설치 직후 제출된 파일에 정의된 내장된 Python 함수를 실행하지 못하는 경우가 있다는 것입니다.
It looks like JMP continues executing the script PowerShell 설치 프로세스가 실제로 완료되기 전에.
The error I get is that Python cannot find one of the functions defined in the two Python Submit File calls.
첫 번째 설치가 성공적으로 완료된 후에는 모든 것이 정상적으로 작동합니다(아마도 패키지가 이미 존재하고 스크립트가 제대로 로드되었기 때문일 것입니다).
How can I make sure that JMP waits until the PowerShell installation process is fully completed before running Python Submit File()?
내 코드에서 관련 부분은 다음과 같습니다.
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" );
Read Function("text")을 사용하는 것은 한 가지 옵션입니다.
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");