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'
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.