简体   繁体   中英

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM