python 3.x - Can't create s3 resource/client in boto3 -


edit: believe traceback stems sort of issue dependencies. using pip upgrade packages didn't work created new folder , installed scratch , worked out

i'm python novice i'm struggling debug aws lambda i'm writing.

i've narrowed down line of code s3_client = botosession.resource('s3'), giving long traceback syntax error: invalid syntax. botosession variable credentials - botosession = boto3.session.session(aws_access_token, aws_secret_access_token).

i've tried s3_client = boto3.client('s3'), s3_client = boto3.resource('s3'), s3_client = botosession.resource('s3').

when used botosession.client('ses', region) had no issues sending emails.

i found error: client = boto3.client('s3') | aws elastic beanstalk worker environment appeared similar issue, appeared old , wasn't able figure out solution was. tried adding import sys sys.path = [p p in sys.path if not p.endswith('futures-3.0.3-py3.4.egg')] top of file didn't seem work.

the entire traceback follows:

traceback (most recent call last):   file "smartsheetexporter.py", line 45, in <module>     s3_client = botosession.resource('s3')   file "/users/nihar/localdocs/pythonpractice/smartsheet-emailer-lambda/boto3/session.py", line 389, in resource     aws_session_token=aws_session_token, config=config)   file "/users/nihar/localdocs/pythonpractice/smartsheet-emailer-lambda/boto3/session.py", line 263, in client     aws_session_token=aws_session_token, config=config)   file "/users/nihar/localdocs/pythonpractice/smartsheet-emailer-lambda/botocore/session.py", line 836, in create_client     client_config=config, api_version=api_version)   file "/users/nihar/localdocs/pythonpractice/smartsheet-emailer-lambda/botocore/client.py", line 65, in create_client     cls = self._create_client_class(service_name, service_model)   file "/users/nihar/localdocs/pythonpractice/smartsheet-emailer-lambda/botocore/client.py", line 90, in _create_client_class     base_classes=bases)   file "/users/nihar/localdocs/pythonpractice/smartsheet-emailer-lambda/botocore/hooks.py", line 227, in emit     return self._emit(event_name, kwargs)   file "/users/nihar/localdocs/pythonpractice/smartsheet-emailer-lambda/botocore/hooks.py", line 210, in _emit     response = handler(**kwargs)   file "/users/nihar/localdocs/pythonpractice/smartsheet-emailer-lambda/boto3/utils.py", line 61, in _handler     module = import_module(module)   file "/users/nihar/localdocs/pythonpractice/smartsheet-emailer-lambda/boto3/utils.py", line 52, in import_module     __import__(name)   file "/users/nihar/localdocs/pythonpractice/smartsheet-emailer-lambda/boto3/s3/inject.py", line 15, in <module>     boto3.s3.transfer import create_transfer_manager   file "/users/nihar/localdocs/pythonpractice/smartsheet-emailer-lambda/boto3/s3/transfer.py", line 127, in <module>     s3transfer.exceptions import retriesexceedederror \   file "/users/nihar/localdocs/pythonpractice/smartsheet-emailer-lambda/s3transfer/__init__.py", line 134, in <module>     import concurrent.futures   file "/users/nihar/localdocs/pythonpractice/smartsheet-emailer-lambda/concurrent/futures/__init__.py", line 8, in <module>     concurrent.futures._base import (first_completed,   file "/users/nihar/localdocs/pythonpractice/smartsheet-emailer-lambda/concurrent/futures/_base.py", line 381     raise exception_type, self._exception, self._traceback                         ^ syntaxerror: invalid syntax 

whenever strange things happening, it's idea update things:

sudo pip install pip --upgrade sudo pip install boto --upgrade sudo pip install boto3 --upgrade sudo pip install awscli --upgrade 

if you're using python 3, try pip3 instead of pip.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -