Python Psphere问题

时间:2012-02-17 12:31:54

标签: python vmware

看着使用psphere。我已经通过pip成功安装了它,但在执行以下代码时遇到了问题(取自psphere文档站点):

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 ':'", self.get_mark()) yaml.scanner.ScannerError: while scanning a simple key in "C:\Users\thor/.psphere/config.yaml", line 5, column 1

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

  1. 没有.psphere目录或config.yaml。我创造了两个而且没有快乐(虽然我必须诚实 - 我不知道yaml文件中应该是什么。)
  2. 没有:在我的档案中,所以我不知道为什么会提出例外。
  3. 帮助将不胜感激。感谢。

1 个答案:

答案 0 :(得分:1)

在发行版的examples /目录中,你可以使用一个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
相关问题