pythonattributeerrorpython-3.10

Python 3.10 - Lib pyfiglet


I get an error: "AttributeError: partially initialized module 'pyfiglet' has no attribute 'figlet_format' (most likely due to a circular import)".

However, 2 days ago there was no such error, and pyfiglet was working properly.

How do I fix this error?

My very simple code:

import pyfiglet

txt = pyfiglet.figlet_format("TEXT", font="banner3-D")
print(txt)

Solution

  • Generally, the Python Circular Import problem occurs when you accidentally name your working file the same as the module name and those modules depend on each other. This way the python opens the same file which causes a circular loop and eventually throws an error. -pythonpool.com

    so rename the python file.don't save it as pyfiglet.py it worked for me