AttributeError: partially initialized module has no attribute…(Python)

Less of a blog post and more of a reminder to myself that when Python says:

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

It is normally because I have named my Python file the same as the module I am importing and caused a circular reference. In this case I am looking at using the Python logging module and saved my Python file as logging.py, so when I then imported logging and tried to call on its functions it failed.

Python AttributeError: partially initialized module
Python AttributeError: partially initialized module

The solution is not to name the Python file the same as any of the modules being imported in that Python file.

Welcome to GeekTechStuff

my home away from home and where I will be sharing my adventures in the world of technology and all things geek.

The technology subjects have varied over the years from Python code to handle ciphers and Pig Latin, to IoT sensors in Azure and Python handling Bluetooth, to Ansible and Terraform and material around DevOps.

Let’s connect