Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python3如何通过ssh使用avconv?_Python_Ssh_Paramiko - Fatal编程技术网

python3如何通过ssh使用avconv?

python3如何通过ssh使用avconv?,python,ssh,paramiko,Python,Ssh,Paramiko,我导入paramiko以使用ssh向我的VPS发送命令。命令“avconv”在我的VPS上运行良好。但在python中,通过ssh发送,其标准输出是“”,它什么也不做 def sshclient_execmd(hostname, port, username, password, execmd): paramiko.util.log_to_file('paramiko.log') s = paramiko.SSHClient() s.set_missing_h

我导入paramiko以使用ssh向我的VPS发送命令。命令“avconv”在我的VPS上运行良好。但在python中,通过ssh发送,其标准输出是“”,它什么也不做

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)

不知怎的,“avconv”变成了“command not found.”所以使用它的路径“/usr/local/bin/avconv”可以修复它。

你在哪里调用这些函数?只是在main()中使用它们。你怎么知道avconv写入stdout?stdout不是主要问题。我使用avconv将视频与声音合并。我检查了VPS,但它没有。这让我很困惑,谢谢!我在stderr中找到错误信息。现在我可以修好了。