Pygame assertion error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Pygame assertion error

I get an error when I ran pygame and I am using pydroid 3. This is the code: This is the error: Traceback (most recent call last): File "/data/user/0/ru.iiec.pydroid3/files/", line 2, in <module> import pygame, sys File "/storage/emulated/0/Android/data/ru.iiec.pydroid3/files/", line 15, in <module> b = AlienInvasion() File "/storage/emulated/0/Android/data/ru.iiec.pydroid3/files/", line 6, in __init__ pygame.init() AttributeError: partially initialized module 'pygame' has no attribute 'init' (most likely due to a circular import) It does not make sense to me

14th Oct 2021, 4:41 PM
Richard - avatar
2 Answers
+ 2
"most likely due to a circular import" Sounds like an issue with the import of pygame. Maybe there is some kind of issue caused by the fact that you first import the entire pygame module and then a submodule of pygame.
14th Oct 2021, 5:54 PM
Simon Sauter
Simon Sauter - avatar
+ 2
Simon Sauter, I figured it out.If anyone is reading this .please watch the way you name your files.I named my file pygame and circular import happened. Please be careful it can put you in a mess🙆‍♀️
15th Oct 2021, 7:10 AM
Richard - avatar