我正在尝试从 mrjob 模块访问 s3 文件。这是失败的代码:
from mrjob.emr import S3Filesystem
fs = S3Filesystem("<aws_access_key_id>", "<aws_secret_access_key>", "us-west-2")
fs.get_s3_key("s3n://<bucket>/<folder>/file.txt")
(但使用实际的 aws_access_key_id、aws_secret_access_key、存储桶和文件夹),我得到的错误是:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/mrjob/fs/s3.py", line 235, in get_s3_key
bucket = s3_conn.get_bucket(bucket_name)
File "/usr/local/lib/python2.7/dist-packages/mrjob/retry.py", line 80, in call_and_maybe_retry
return f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/boto/s3/connection.py", line 431, in get_bucket
bucket.get_all_keys(headers, maxkeys=0)
File "/usr/local/lib/python2.7/dist-packages/boto/s3/bucket.py", line 375, in get_all_keys
'', headers, **params)
File "/usr/local/lib/python2.7/dist-packages/boto/s3/bucket.py", line 332, in _get_all
query_args=query_args)
File "/usr/local/lib/python2.7/dist-packages/boto/s3/connection.py", line 547, in make_request
retry_handler=retry_handler
File "/usr/local/lib/python2.7/dist-packages/boto/connection.py", line 947, in make_request
retry_handler=retry_handler)
File "/usr/local/lib/python2.7/dist-packages/boto/connection.py", line 908, in _mexe
raise e
gaierror: [Errno -2] Name or service not known
有什么建议么?谢谢!