0
ssh를 사용하여 paramiko를 가져 와서 내 VPS에 명령을 보냅니다. 'avconv'명령은 내 VPS에서 잘 작동합니다. 그러나 파이썬에서 ssh를 통해 전송하면 stdout은 ''아무것도하지 않습니다.python3은 ssh를 통해 avconv를 어떻게 사용합니까?
def sshclient_execmd(hostname, port, username, password, execmd):
paramiko.util.log_to_file('paramiko.log')
s = paramiko.SSHClient()
s.set_missing_host_key_policy(paramiko.AutoAddPolicy())
s.connect(hostname=hostname, port=port, username=username, password=password)
stdin, stdout, stderr = s.exec_command (execmd)
info = stdout.read().decode()
s.close()
return info
def merge(hostname, port, username, password, filename):
execmd = 'avconv -i \''+filename+'.mp4\' -i \''+filename+'.m4a\' -c copy \''+filename+'.mp4.mp4\''
info = sshclient_execmd(hostname, port, username, password, execmd)
print(info)
어디에서 이러한 함수를 호출합니까? –
그냥 main()에서 사용하는 것 –
avconv가 stdout에 쓰는 것을 어떻게 알 수 있습니까? –