2017-08-30 9 views
0

私はDynamoDBデータベースをシードするために使用するファイル(conversation_template.pyと呼ばれる)を持っています。私は、コマンドラインでそれを実行するとコマンドラインでデータベースをシードするときの奇妙なSSLエラー

import boto3 

dynamodb = boto3.resource('dynamodb', region_name='us-east-1') 
table = dynamodb.Table('tablename') 

data = {'<data_goes_here>'} 


def add_to_table(): 
     table.put_item(Item=data) 


add_to_table() 

は今、私はこれを取得:

Traceback (most recent call last): 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 544, in urlopen 
    body=body, headers=headers) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 341, in _make_request 
    self._validate_conn(conn) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 761, in _validate_conn 
    conn.connect() 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/connection.py", line 238, in connect 
    ssl_version=resolved_ssl_version) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/util/ssl_.py", line 279, in ssl_wrap_socket 
    return context.wrap_socket(sock, server_hostname=server_hostname) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/ssl.py", line 401, in wrap_socket 
    _context=self, _session=session) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/ssl.py", line 808, in __init__ 
    self.do_handshake() 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/ssl.py", line 1061, in do_handshake 
    self._sslobj.do_handshake() 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/ssl.py", line 683, in do_handshake 
    self._sslobj.do_handshake() 
ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:748) 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/adapters.py", line 370, in send 
    timeout=timeout 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 574, in urlopen 
    raise SSLError(e) 
botocore.vendored.requests.packages.urllib3.exceptions.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:748) 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
    File "conversation_template.py", line 74, in <module> 
    add_to_table() 
    File "conversation_template.py", line 71, in add_to_table 
    table.put_item(Item=episode) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/boto3/resources/factory.py", line 520, in do_action 
    response = action(self, *args, **kwargs) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/boto3/resources/action.py", line 83, in __call__ 
    response = getattr(parent.meta.client, operation_name)(**params) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/client.py", line 312, in _api_call 
    return self._make_api_call(operation_name, kwargs) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/client.py", line 588, in _make_api_call 
    operation_model, request_dict) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/endpoint.py", line 141, in make_request 
    return self._send_request(request_dict, operation_model) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/endpoint.py", line 170, in _send_request 
    success_response, exception): 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/endpoint.py", line 249, in _needs_retry 
    caught_exception=caught_exception, request_dict=request_dict) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/hooks.py", line 227, in emit 
    return self._emit(event_name, kwargs) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/hooks.py", line 210, in _emit 
    response = handler(**kwargs) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/retryhandler.py", line 183, in __call__ 
    if self._checker(attempts, response, caught_exception): 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/retryhandler.py", line 251, in __call__ 
    caught_exception) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/retryhandler.py", line 277, in _should_retry 
    return self._checker(attempt_number, response, caught_exception) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/retryhandler.py", line 317, in __call__ 
    caught_exception) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/retryhandler.py", line 223, in __call__ 
    attempt_number, caught_exception) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception 
    raise caught_exception 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/endpoint.py", line 204, in _get_response 
    proxies=self.proxies, timeout=self.timeout) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/sessions.py", line 573, in send 
    r = adapter.send(request, **kwargs) 
    File "/Users/user/anaconda/envs/django_pocketcoach/lib/python3.6/site-packages/botocore/vendored/requests/adapters.py", line 431, in send 
    raise SSLError(e, request=request) 
botocore.vendored.requests.exceptions.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:748) 

私はエラーがどこから来るのかを把握することを試みたが、私はそれを行うことができませんでした。エラーメッセージでさえ私をどこにも惹かなかった。

SSLErrorが発生しました。プロトコルは不明です。私は、このタイプのエラーがプロキシサーバに接続しようとしていることに関連している可能性があることを知っていましたが、私はこれを使用していないし、

このエラーの原因は何ですか?最後に働いていた何

+0

これは単なるスタックトレースです。コードはどこですか? – AK47

+0

コードが動作しなくなってから変更されていないので、問題ではないと確信しています。とにかくコードを追加します –

答えて

0

は私の現在の仮想環境を終了し、実行することです:

/Applications/Python\ 3.6/Install\ Certificates.command 

そして私は再び私の仮想環境を入力して実行しました。それを固定

pip install certifi 

を。

認定資格(これに関連する:urllib and "SSL: CERTIFICATE_VERIFY_FAILED" Error)と関係があると思われる友人から助けを求められましたが、「証明書の確認に失敗しました」というエラーが表示されない理由は不明です。