[英]Error while connecting to a region under a profile
As per document region is also a parameter of boto.emr.EmrConnection class however, I get the follwoing error while making the connection: conn = boto.emr.EmrConnection(profile_name='profile_name', region='us-west-2') 由于每个文档区域也是boto.emr.EmrConnection类的参数,因此在建立连接时出现以下错误:conn = boto.emr.EmrConnection(profile_name ='profile_name',region ='us-west-2' )
File "C:\\Python27\\lib\\site-packages\\boto-2.38.0-py2.7.egg\\boto\\emr\\connection.py", line 68, in init self.region.endpoint, debug, AttributeError: 'str' object has no attribute 'endpoint' 在初始化 self.region.endpoint的文件“ C:\\ Python27 \\ lib \\ site-packages \\ boto-2.38.0-py2.7.egg \\ boto \\ emr \\ connection.py”,行68,调试,AttributeError:' str'对象没有属性'endpoint'
Any idea? 任何想法?
The method is expecting RegionInfo type for region, not string. 该方法需要区域的RegionInfo类型,而不是字符串。
So pass boto.ec2.get_region('us-west-2')
instead of 'us-west-2'
因此,传递boto.ec2.get_region('us-west-2')
而不是'us-west-2'
import boto.ec2
boto.emr.EmrConnection(profile_name='profile_name', region=boto.ec2.get_region('us-west-2'))
The method expects RegionInfo so try: 该方法需要RegionInfo,因此请尝试:
import boto.emr
conn = boto.emr.connect_to_region('us-west-1')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.