简体   繁体   中英

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')

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'

Any idea?

The method is expecting RegionInfo type for region, not string.

So pass boto.ec2.get_region('us-west-2') instead of '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:

import boto.emr
conn = boto.emr.connect_to_region('us-west-1')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM