'Cannot import name games'
I'm a beginner and so far I have about 3 hours invested installing pygame( ie getting the python interpreter to accept 'from livewires import games, color' to check both 'pygame' and 'livewires' have installed).
However, when I ran my first source code I got this:
Traceback (most recent call last):
File "C:/Python31/Coding/pygame.py", line 4, in <module>
from livewires import games
File "C:\Python31\lib\site-packages\livewires\games.py", line 57, in <module>
import pygame, pygame.image, pygame.mixer, pygame.font, pygame.transform
File "C:/Python31/Coding\pygame.py", line 4, in <module>
from livewires import games
ImportError: cannot import name games
>>>
Why might this be happening? Does anyone have some pointers? I don't have any hours left to figure it out myself, what with a full-time job and life matters.
Thanks,
Dave
Code:
# New graphics window
# Demo's creating a graphics window
from livewires import games
# initialize graphics screen
games.init(screen_width = 640, screen_height = 480, fps = 50)
# start mainloop
games.screen.mainloop()
Solution 1:
You naming your code script pygame.py
which rises a conflict with pygame
library. Change the name and try it again.