[英]libcloud: missing 1 required positional argument error during driver init
I'm using: 我正在使用:
Python code looks like this: Python代码如下所示:
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
def run():
""" Run this script
"""
ComputeEngine = get_driver(Provider.GCE)
driver = ComputeEngine(user_id='****@****.com',
credential_file='serviceaccount.json',
project='****')
run()
When I run my code, I'm getting: 当我运行代码时,我得到:
Traceback (most recent call last):
File "./myscript.py", line 47, in <module>
run()
File "./myscript.py", line 21, in run
project='ebs-it', secure=True)
File "/***/virtualenv/lib/python3.5/site-packages/libcloud/compute/drivers/gce.py", line 1795, in __init__
super(GCENodeDriver, self).__init__(user_id, key, **kwargs)
File "/***/virtualenv/lib/python3.5/site-packages/libcloud/common/base.py", line 975, in __init__
self.connection = self.connectionCls(*args, **conn_kwargs)
TypeError: __init__() missing 1 required positional argument: 'secure'
This looks perfectly textbook to me. 这对我来说似乎是完美的教科书 。 Any idea what could be going wrong?
任何想法可能出什么问题吗?
The issue was two fold: unfamiliarity with Google's service accounts, which led to an error in coding. 这个问题有两个方面:不熟悉Google的服务帐户,这导致编码错误。
credential_file
parameter, which seemed to fit better than the key
parameter that should be used for the service account file. credential_file
参数,该参数似乎比应该用于服务帐户文件的key
参数更好。 That is what led to the actual error I was seeing.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.