ssh (C# 및 SharpSSH 사용)를 통해 python 스크립트를 실행하는 데 문제가 있습니다.Csharp와 SharpSSH를 사용하여 raspberry pi에 SSH 명령을 통해 python 실행
나는 연결이 내가 파이썬 스크립트 프로그램을 동결하고 아무 일도 발생하지 실행하려고하면 "startx로"와 "sudo를 종료 ..."
같은 간단한 명령을 쓸 수 있습니다. "putty"와 똑같은 절차를 시도했으며 예상대로 작동합니다.
python 스크립트가 실행되고 데이터가 인쇄됩니다 (인쇄 : '레이저 없음, 빠른 이동 : Dx =', stepx, 'Dy =', stepy) whitch가 내 응용 프로그램에 적용됩니다.
C#의 SharpSSH 연결
ssh = new SshStream(host, user, password);
//Set the end of response matcher character
ssh.Prompt = "#";
//Remove terminal emulation characters
ssh.RemoveTerminalEmulationCharacters = true;
//Reading from the SSH channel
string response = ssh.ReadResponse();
return response;
C#을 Gcode_executer.py 작동 라즈베리 파이가 실행 해달라고 (PC에서) 파이썬 파일을 프로그램을 정지하지 않습니다 시작
try
{
ssh.Write("sudo python cnc/Gcode_executer.py"); // Write ssh to RPI
// works it in putty
if (ssh.CanRead == true)
{
return ssh.ReadResponse(); // return string from terminal from RPI
}
else
{
return "No response";
}
}
catch
{
return "Catch NO response";
}
나는 문제를 해결하기 위해 할 수있는 일 ?