I have the following code:
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
import pygame, random
from pygame.locals import *
pygame.init()
clock = pyg
Your problem is that you have a file that is named pygame.py
, or a bytecode left-over from such a file named pygame.pyc
.
Calling import pygame
works, but it will not import pygame, but the that very file.
And since your file can't find a module named locals
in that file, the error is raised.
So, just rename your file to anything other than pygame.py
or other modules you want to import, or, if there's a pygame.pyc
bytecode file, remove that.