trouble using pygame

MRAB python at mrabarnett.plus.com
Fri Mar 5 23:28:35 EST 2021


On 2021-03-06 02:54, Quentin Bock wrote:
> So, I recently downloaded the pygame module, this code is from a youtube
> tutorial by the way, I am following along the tutorial, the error involves
> the pygame.init() and also says this:
> 
> import pygame
> 
> # Initialize Pygame
> pygame.init()
> 
> #create the screen
> screen = pygame.display.set_mode((800, 600))
> 
> # Game Loop
> running = True
> while running:
>      for event in pygame.event.get():
>          if event.type == pygame.quit():
>              running = False
> 
> The error says "partially initialized module 'pygame' has no attribute
> 'init' (most likely due to a circular import)
> 
> If someone could also explain what a circular import is and how to
> avoid them within the future that would be great
> 
> Thanks :)
> 
> Here is a link to the tutorial  as well just in case someone wants to see it:
> 
> https://www.youtube.com/watch?v=FfWpgLFMI7w
> 
A circular import is when a module tries to import itself directly or 
indirectly. (A imports A; A imports B, which imports A; A imports B, 
which imports C, which imports A; you get the idea!)

What did you call your script? Did you perhaps call it "pygame"?


More information about the Python-list mailing list