Samuel Thampy
Samuel Thampy

Reputation: 123

Boto3 error with logging handler

I am getting this error when I try to import the boto3 library. I have installed boto3 1.4.1 and also tried downgrading to 1.3.1 and still I am getting this below error

Traceback (most recent call last):
  File "storage.py", line 1, in <module>
    import boto3
  File "/Library/Python/2.7/site-packages/boto3/__init__.py", line 16, in <module>
    from boto3.session import Session
  File "/Library/Python/2.7/site-packages/boto3/session.py", line 17, in <module>
    import botocore.session
  File "/usr/local/lib/python2.7/site-packages/botocore/__init__.py", line 22, in <module>
    class NullHandler(logging.Handler):
AttributeError: 'module' object has no attribute 'Handler'

Upvotes: 2

Views: 1659

Answers (1)

TylerW
TylerW

Reputation: 331

I've found that this can happen when a file named logging.py exists in the same directory as your Python script (storage.py). This is because Boto3 tries to import the logging module, but it imports logging.py instead.

To fix, move or rename logging.py, or move your Python script.

Upvotes: 10

Related Questions