Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SyntaxError when calling boto3.clilent('s3')

See original GitHub issue

I have an issue when initializing s3 client with python3.6 and boto3-1.5.6. Here is an example code.

import boto3
client = boto3.client('s3')

I got the following error.

Traceback (most recent call last):
  File "/home/ec2-user/environment/debug/", line 2, in <module>
    client = boto3.client('s3')
  File "/home/ec2-user/environment/debug/boto3/", line 83, in client
    return _get_default_session().client(*args, **kwargs)
  File "/home/ec2-user/environment/debug/boto3/", line 263, in client
    aws_session_token=aws_session_token, config=config)
  File "/home/ec2-user/environment/debug/botocore/", line 861, in create_client
    client_config=config, api_version=api_version)
  File "/home/ec2-user/environment/debug/botocore/", line 70, in create_client
    cls = self._create_client_class(service_name, service_model)
  File "/home/ec2-user/environment/debug/botocore/", line 95, in _create_client_class
  File "/home/ec2-user/environment/debug/botocore/", line 227, in emit
    return self._emit(event_name, kwargs)
  File "/home/ec2-user/environment/debug/botocore/", line 210, in _emit
    response = handler(**kwargs)
  File "/home/ec2-user/environment/debug/boto3/", line 61, in _handler
    module = import_module(module)
  File "/home/ec2-user/environment/debug/boto3/", line 52, in import_module
  File "/home/ec2-user/environment/debug/boto3/s3/", line 15, in <module>
    from boto3.s3.transfer import create_transfer_manager
  File "/home/ec2-user/environment/debug/boto3/s3/", line 127, in <module>
    from s3transfer.exceptions import RetriesExceededError as \
  File "/home/ec2-user/environment/debug/s3transfer/", line 134, in <module>
    import concurrent.futures
  File "/home/ec2-user/environment/debug/concurrent/futures/", line 8, in <module>
    from concurrent.futures._base import (FIRST_COMPLETED,
  File "/home/ec2-user/environment/debug/concurrent/futures/", line 414
    raise exception_type, self._exception, self._traceback
SyntaxError: invalid syntax

Testing environment is by using AWS Cloud9, however the same error is reproduced in another environment with python3.6 and newest boto3.

In the case of creating DynamoDB client, there is no error.

How can I fix it ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

dac73commented, Jan 24, 2019

Why is this closed? I just had this problem, the only extra package installed is requests

stealthycoincommented, Jan 16, 2018

Closing due to inactivity.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid syntax error using AWS' boto3 for the service 's3 ...
It looks like the version of boto3 you have installed has somehow picked up an extra comma at the end of a line....
Read more >
Error handling — Boto3 Docs 1.26.32 documentation - AWS
Any Boto3 clients you create will use these same statically defined exception classes. The most common botocore exception you'll encounter is ClientError ....
Read more >
Troubleshooting AWS CLI errors - AWS Command Line Interface
This error means that the operating system can't find the AWS CLI command. The installation might be incomplete or requires updating. ... Example...
Read more >
Handling Errors in Boto3 & Botocore - Trek10
Imagine you have a call that may fail (known more commonly as "every call"). ... import boto3 s3 = boto3.client('s3') try: s3.create_bucket(Bucket='test') ...
Read more >
Automatically Tagging Uploads to S3 - Greg Heywood
I read the AWS CLI are written using Python and Boto 3. Not sure if that is true, ... s3 = boto3.client('s3') print(dir(client))....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found