2012-02-17 69 views
0

展望。我已經通過PIP安裝成功,但碰上當我執行下面的代碼(從psphere文檔站點採取)的一個問題:Python的Psphere問題

"could not found expected ':'", self.get_mark()) yaml.scanner.ScannerError: while scanning a simple key in "C:\Users\thor/.psphere/config.yaml", line 5, column 1

from psphere.client import Client 
from psphere.managedobjects import HostSystem 


Client = Client("server", "username", "password") 

hs_list = HostSystem.all(Client) 
len(hs_list) 

運行的命令,我得到以下後

could not found expected ':' in "C:\Users\thor/.psphere/config.yaml", line 6, column 1

  1. 有沒有.psphere目錄或config.yaml。我創建既沒有喜悅(儘管我必須說實話 - 我真的不知道應該在YAML文件的內容。)
  2. 沒有:在我的文件,所以我不知道爲什麼它拋出異常。

幫助,將不勝感激。謝謝。

在分佈的例子/目錄

回答

1

有可以使用sample_config.yaml文件。

# Copy this file into ~/.psphree/config.yaml and edit to your liking 
general: 
    server: your.esxserver.com 
    username: Administrator 
    password: strongpassword 
    template_dir: ~/.psphere/templates/ 
logging: 
    destination: ~/.psphere/psphere.log 
    level: INFO # DEBUG, INFO, etc 
+0

謝謝你爲這個! – Paul 2012-03-08 18:02:48