我收到了一个python错误,它将记录器对象显示为Logger,将小写的"L“改为"l”。以下是错误:
Traceback (most recent call last):
File "/Users/user/PycharmProjects/stocks/stock-watchlist/Notes.py", line 195, in <module>
logger.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S')
AttributeError: 'Logger' object has no attribute 'basicConfig'语言: PyCharm PyCharm 2021.1 (Community ) Build #PC-211.6693.115,建于2021年4月6日运行时版本: 11.0.10+9-b1341.35 x86_64 VM:动态代码演进64位服务器VM,由JetBrains s.r.o编写。macOS 12.4 GC: G1年轻一代,G1老一代内存:2048 M核:8个非捆绑插件: IdeaVIM (1.9.2),Key Promoter X (2021.1.1),cn.haojiyou.CodeGlance3 (2.0.1),com.mallowigi (36.0),com.markskelton.one-暗主题(5.6.0),com.nasller.CodeGlancePro (1.3.8-Last2021.3.x),com.tabnine.TabNine (0.7.2),io.acari.DDLCTheme (78.2-1.1.1),io.unthrottled.amii (0.14.1),zd.zero.wefu-动机-插件(2.2.0),izhangzhihao.rainbow.brackets (6.24),org.exbin.deltahex.intellij (0.2.6)
发布于 2022-07-02 16:25:27
正如Jhon所提到的:
Logger是对象的类型,而不是它的名称。
logger = logging.getLogger(__name__)使用与我的变量同名的getLogger()方法,解释为什么它看起来像编译器--错误改变了字母的大小写,这完全是巧合。
发布于 2022-07-01 02:53:47
https://stackoverflow.com/questions/72823786
复制相似问题