używam python i botoAmazon S3 określonego klucza nie istnieje po get_key sukcesu
to mój kod:
key = bucket.get_key(key_name)
if not key:
print 'error, key does not exist'
return
data = key.get_contents_as_string()
czasami (pojawia się losowo) i uzyskać ten wyjątek:
S3ResponseError: S3ResponseError: 404 Not Found
UWAGA: plik jest przesyłany przez jeden serwer, a następnie bezpośrednio po nim kolejny serwer (znajdujący się na innym kontynencie) uruchamia powyższy kod.
ślad błędu:
Traceback (most recent call last): File "/test.py", line 222, in _process_response
data = key.get_contents_as_string() File "/usr/lib/python2.6/site-packages/boto-2.1.1-py2.6.egg/boto/s3/key.py",
line 1201, in get_contents_as_string response_headers=response_headers) File "/usr/lib/python2.6/site-packages/boto-2.1.1-py2.6.egg/boto/s3/key.py",
line 1093, in get_contents_to_file response_headers=response_headers) File "/usr/lib/python2.6/site-packages/boto-2.1.1-py2.6.egg/boto/s3/key.py",
line 996, in get_file override_num_retries=override_num_retries) File "/usr/lib/python2.6/site-packages/boto-2.1.1-py2.6.egg/boto/s3/key.py",
line 211, in open override_num_retries=override_num_retries) File "/usr/lib/python2.6/site-packages/boto-2.1.1-py2.6.egg/boto/s3/key.py",
line 165, in open_read self.resp.reason, body) S3ResponseError: S3ResponseError: 404 Not Found
NoSuchKey
The specified key does not exist.key_nameidhost_id
więc dostać klucz, ale wtedy, gdy próbuję i odczytać z niego i się „nie znaleziono”. jakiś pomysł?