2013-07-03 69 views
1

我試圖從mrjob模塊訪問s3文件。 這裏是一個的失敗代碼:python mrjob - gaierror:[Errno -2]名稱或服務未知

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 

有什麼建議? 謝謝!

回答

-1

這(S3N://)

fs.get_s3_key("s3n://<bucket>/<folder>/file.txt") 

應該是這樣的(S3://):

fs.get_s3_key("s3://<bucket>/<folder>/file.txt") 
+0

使用S3:// ...不工作... – Disha

相關問題