无法通过ROBOT框架的SSH库执行命令运行Python脚本

0 投票
1 回答
2561 浏览
提问于 2025-04-17 21:26
ssh_obj.execute_command('python /tmp/posttoci.py',return_stdout=True, return_stderr=True,return_rc=True)

在使用RIDE的时候,记录了以下内容

"20140308 21:52:37.106 :  INFO : Executing command 'python /tmp/posttoci.py'.

20140308 21:52:37.224 :  INFO : Command exited with return code 1."

我无法在远程机器上执行Python脚本。请帮帮我。

注意:我已经成功使用ssh库的open connection关键字和login关键字登录到远程机器。

1 个回答

0

那个 posttoci.py 文件是在远程机器上吗?还是在你开始 SSH 会话的本地机器上?

如果它在本地机器上,你可以用“上传文件”把它复制到目标机器上,然后再用“执行命令”。

Open Connection ${IP}
Login ${user} ${password}
SSH Library.Put File    ${source}   /tmp/posttoci.py
Execute Command python /tmp/posttoci.py

撰写回答