[英]Boto3 error with logging handler
I am getting this error when I try to import the boto3 library. 尝试导入boto3库时出现此错误。 I have installed boto3 1.4.1 and also tried downgrading to 1.3.1 and still I am getting this below error
我已经安装了boto3 1.4.1,并且还尝试降级到1.3.1,但仍然出现以下错误
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
). 我发现当与Python脚本(
storage.py
)位于同一目录中的文件名为logging.py
时,可能会发生这种情况。 This is because Boto3 tries to import the logging module, but it imports logging.py
instead. 这是因为Boto3尝试导入日志记录模块,但改为导入
logging.py
。
To fix, move or rename logging.py
, or move your Python script. 要修复,移动或重命名
logging.py
,或移动您的Python脚本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.