AttributeError:partially initialized module ‘logging‘ has no attribute ‘basicConfig‘报错处理

Errors encountered when using python's logging library

test code

The file name is:logging.py

import logging

logging.basicConfig()
logging.debug('This is a debug message')
logging.info('This is an info message')
logging.warning('This is a warning message')
logging.error('This is an error message')
logging.critical('This is a critical message')

error message

AttributeError: partially initialized module 'logging' has no attribute 'basicConfig' (most likely due to a circular import)

Solution

Willlogging.pyfile replaced with otherxx.py

Result after change

WARNING:root:This is a warning message
ERROR:root:This is an error message
CRITICAL:root:This is a critical message

Guess you like

Origin blog.csdn.net/qq_42578742/article/details/123027908