2
有人能告訴我,我在做下面的代碼有什麼錯誤,我嘗試使用機器人框架,運行shell命令,我已經使用以下命令安裝sshlibrary模塊 - pip install robotframework-sshlibrary
。但是我仍然收到導入SSHLibrary失敗的錯誤。我的操作系統是Ubuntu14.04。如何通過robotframework執行ssh命令
Deploy.robot
*** Settings ***
Library SSHLibrary
Resource configuration.txt
*** Variables ***
${OBR_HOST} 10.110.72.192
${OBR_USERNAME} root
${OBR_PASSWORD} password
*** Test Cases ***
Deploy OBR machine code
${output}= Execute Command /root/deploy.sh
log to console ${\n}${output}
*** Keywords ***
open_connection_and_login
Open Connection ${OBR_HOST}
Login ${OBR_USERNAME} ${OBR_PASSWORD}
執行日誌
[email protected]:~# pybot ssh-example.robot
[ ERROR ] Error in file '/root/ssh-example.robot': Importing test library 'SSHLibrary' failed: ImportError: Importing Paramiko library failed. Make sure you have Paramiko installed.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/SSHLibrary/__init__.py", line 15, in <module>
from .library import SSHLibrary
File "/usr/local/lib/python2.7/dist-packages/SSHLibrary/library.py", line 22, in <module>
from .client import SSHClient
File "/usr/local/lib/python2.7/dist-packages/SSHLibrary/client.py", line 20, in <module>
from pythonclient import PythonSSHClient as SSHClient
File "/usr/local/lib/python2.7/dist-packages/SSHLibrary/pythonclient.py", line 21, in <module>
'Importing Paramiko library failed. '
PYTHONPATH:
/usr/local/bin
/usr/lib/python2.7
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PILcompat
/usr/lib/python2.7/dist-packages/gtk-2.0
/usr/lib/python2.7/dist-packages/ubuntu-sso-client
==============================================================================
Ssh-Example
==============================================================================
Execute Deploy command | FAIL |
Parent suite setup failed:
No keyword with name 'Open Connection' found.
------------------------------------------------------------------------------
Ssh-Example | FAIL |
Suite setup failed:
No keyword with name 'Open Connection' found.
Also suite teardown failed:
No keyword with name 'Close All Connections' found.
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output: /root/output.xml
Log: /root/log.html
Report: /root/report.html
[email protected]:~# pip install robotframework-sshlibrary
Requirement already satisfied (use --upgrade to upgrade): robotframework-sshlibrary in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): robotframework in /usr/local/lib/python2.7/dist-packages (from robotframework-sshlibrary)
Requirement already satisfied (use --upgrade to upgrade): paramiko>=1.8.0 in /usr/local/lib/python2.7/dist-packages (from robotframework-sshlibrary)
Cleaning up...
能否請您檢查的paramiko庫安裝? 'pip list | grep paramiko'。它應該作爲sshlibrary的依賴項自動安裝。 –
'root @ 92:〜#pip list |的grep的paramiko 的paramiko(2.1.2)'' 根@ 92:〜#蟒-V 的Python 2.7.6'的paramiko庫的安裝。會不會有任何依賴python版本? – Madhu
稀有案例!但值得檢查系統是否有多個Python版本!和pybot相關的必須用SSH lib進行更新。 – Waman