생성을 통해 NodeJS에서 Python 스크립트를 호출하는 동안 분할 오류(코어 덤프)가 발생했습니다.
-
20-12-2019 - |
문제
통계 R(PypeR 제공)을 통해 긴 목록을 인쇄하는 Python 스크립트가 있습니다.이 Python 스크립트는 정말 잘 작동합니다.
이제 child_process의 생성 기능을 통해 NodeJS에서 이 스크립트를 실행하려고 하는데 다음 오류로 인해 실패합니다.
Traceback (most recent call last):
File "pyper_sample.py", line 5, in <module>
r=R()
File "/home/mehtam/pyper.py", line 582, in __init__
'prog' : Popen(RCMD, stdin=PIPE, stdout=PIPE, stderr=return_err and _STDOUT or childstderr, startupinfo=info),
File "/usr/lib64/python2.6/subprocess.py", line 642, in __init__
errread, errwrite)
File "/usr/lib64/python2.6/subprocess.py", line 1234, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
./temp.sh: line 1: 27500 Segmentation fault (core dumped) python pyper_sample.py o1dn01.tsv cpu_overall
child process exited with code : 139
메모:내 Python 스크립트가 완벽하게 작동합니다.이미 수동으로 테스트했습니다.
해결책
내 Python 스크립트가 완벽하게 작동합니다.이미 수동으로 테스트했습니다.
출력은 다음을 명확하게 보여줍니다. OSError: No such file or directory
동안 예외가 발생했습니다. Popen()
부르다.
이는 프로그램을 찾을 수 없음을 의미합니다. 예:
>>> from subprocess import Popen
>>> p = Popen(["ls", "-l"]) # OK
>>> total 0
>>> p = Popen(["no-such-program-in-current-path"])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
또한 전체 명령을 목록 대신 문자열로 전달합니다(shell=False
기본적으로)은 일반적인 오류입니다.
>>> p = Popen("ls -l")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
확실하게 하다:
- 귀하의 (자녀) 프로그램은 현재에서 찾을 수 있습니다
$PATH
- 문자열 대신 목록 인수를 사용하십시오.
- 다른 작업 디렉터리, 다른 사용자 등에서 수동으로 실행하면 작동하는지 테스트합니다.
메모:당신의 Popen()
통화 패스 startupinfo
그것은 Windows에만 해당됩니다.Windows에서 작동하는 여러 인수가 포함된 문자열 명령은 다음과 같이 실패합니다. "No such file or directory"
유닉스에서 오류가 발생했습니다.
제휴하지 않습니다 StackOverflow