내가 수행하는 중첩 호출과 관련되어야하는 문제가 있습니다.
RunProgram ()-> cmd-> Python
다음 bat 파일은 완벽하게 작동합니다.
set JMP_PYTHON_PTH=%UserProfile%\miniconda_JMP\
CALL %JMP_PYTHON_PTH%\Scripts\activate.bat %JMP_PYTHON_PTH%
start /B /wait "" python test.py
하지만 RunProgram ()을 사용할 때 Python 파일 (test.py-> 'C : /a/b/c/test.py')에 절대 경로를 추가하지 않으면 코드가 실패합니다.
ClearLog();
file_path = ConvertFilePath( "./tests/run_python_installation_test.bat", windows);
rp = RunProgram( Executable( "cmd.exe" ),
Options( {"/C", file_path} ),
ReadFunction("text") // returns all text
);절대 경로가 제공되지 않은 경우에만 다시 발생하는 오류는 다음과 같습니다.
(base) C:\WINDOWS\system32>start /B /wait \!"\!" python test.py
python: can't open file 'test.py': [Errno 2] No such file or directory
내가 이것을 실행할 때
file_path = convertfilepath("$temp/x.bat","windows");
savetextfile(file_path, "dir\!n");
rp = RunProgram( Executable( "cmd.exe" ),
Options( {"/C", file_path} ),
ReadFunction("text") // returns all text
);박쥐 파일 실행을위한 작업 디렉토리가 내 데스크탑 디렉토리 인 것 같습니다. 나는 파이썬이 작업 디렉토리를 사용하여 명령 줄에서도 파일 이름을 찾을 것이라고 생각합니다. 전체 경로 이름을 사용하는 것이 좋은 선택 인 것 같습니다.
https://superuser.com/questions/396394/how-do-i-set-an-executables-working-directory-via-the-command-line-prior-to-ex 시작 명령에서 작업 디렉토리를 지정할 수 있음을 제안합니다.
START /D c:\temp notepad.exe